Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No builtin marshaller support for converting kotlin.ByteArray to application/octetstream #2652

Open
izaxs opened this issue Jan 9, 2023 · 0 comments

Comments

@izaxs
Copy link

izaxs commented Jan 9, 2023

It seems like Misk has no builtin marshaller for kotlin.ByteArray to applicationcon/octetstream by default.

My web action tries to return a PDF file, I set the web action annotation to @ResponseContentType(MediaTypes.APPLICATION_OCTETSTREAM) and return type as Response

Got this error:


    1) [Guice/ErrorInjectingConstructor]: IllegalArgumentException: no marshaller for application/octetstream as Response<kotlin.ByteArray>
      at WebActionsServlet.<init>(WebActionsServlet.kt:42)
      at WebActionsServlet.class(WebActionsServlet.kt:37)
      at JettyService.<init>(JettyService.kt:58)
          \_ for 2nd parameter
      at JettyService.class(JettyService.kt:49)
      while locating JettyServic

Both ByteArray and APPLICATION_OCTETSTREAM are often used in web, so is there any configuration I missed that can be turned on?
If not could you provide some links about how to inject the marshaller in Misk?

Update:
It would be nice to support ByteArray here:

return when (actualResponseType(returnType)) {

@izaxs izaxs changed the title no marshaller for application/octetstream as Response<kotlin.ByteArray> No builtin marshaller support for converting Response<kotlin.ByteArray> to application/octetstream Jan 10, 2023
@izaxs izaxs changed the title No builtin marshaller support for converting Response<kotlin.ByteArray> to application/octetstream No builtin marshaller support for converting kotlin.ByteArray to application/octetstream Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant