Comments (3)
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.
Notice this only happens when unmarshalling, custom marshallers work correctly.
Let me know if any help is needed 😄
from scala-server-lambda.
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)
- Can't install from sbt, `common` submodule isn't published to maven HOT 3
- Snapshot builds HOT 1
- Scala 2.13 version HOT 1
- Json parsing error HOT 6
- Update to http4s 20 HOT 3
- Loss of content type HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scala-server-lambda.