cashapp / misk

Microservice Kontainer

Home Page:https://cashapp.github.io/misk/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

izaxs opened this issue · comments

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