Git Product home page Git Product logo

Comments (3)

howardjohn avatar howardjohn commented on June 13, 2024 1

Thanks for bringing this up. Basically what the issue is is that the content types are not passed through to akka, so everything is counted as a string. The generic marshallers and unmarshallers are strict and will only convert http bodies with a json content type. I will look into fixing this in a bit, I think I know how I can.

For now, if you change your (un)marshallers to this:

  implicit final def unmarshaller[A: Decoder]: FromEntityUnmarshaller[A] =
    Unmarshaller.stringUnmarshaller
     // .forContentTypes(`application/json`) // This is the line that causes the issue
      .flatMap { ctx => mat => json =>
        decode[A](json).fold(Future.failed, Future.successful)
      }

  implicit final def marshaller[A: Encoder]: ToEntityMarshaller[A] =
    Marshaller.withFixedContentType(`application/json`) { a =>
      HttpEntity(`application/json`, a.asJson.noSpaces)
    }

It should work. Note the commented line, which is what was causing this error.

I don't think this affects the http4s one, but I will check as well.

from scala-server-lambda.

ssuarez6 avatar ssuarez6 commented on June 13, 2024

Notice this only happens when unmarshalling, custom marshallers work correctly.
Let me know if any help is needed 😄

from scala-server-lambda.

howardjohn avatar howardjohn commented on June 13, 2024

Should be fixed now from baf3dda.

I published the new version, 0.4.0-SNAPSHOT

Let me know if there are any issues!

from scala-server-lambda.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.