Skip to content

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

@izaxs

Description

@izaxs

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)) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions