Giter Site home page Giter Site logo

http4s-multipart's Introduction

http4s-stream-paged

This is a small demo project demonstrating the problems I encountered while trying to migrate a consumer for a multipart HTTP resource to http4s 1.0.0.

Try it

Start the server

cd 0.22/
sbt "runMain com.l7r7.lab.http4s.multipart.server.Server"

This will start up a web server for testing.

Then run the client using http4s v0.21.22:

cd 0.22/
sbt "runMain com.l7r7.lab.http4s.multipart.ClientApp"

This will get the page, and print out the different parts. The multipart parsing works.

However, if you run the client using http4s v1.0.0-M21:

cd 1.0/
sbt "runMain com.l7r7.lab.http4s.multipart.ClientApp"

The program will fail with the following error:

(run-main-0) org.http4s.MalformedMessageBodyFailure: Malformed message body: Malformed Malformed match
 org.http4s.MalformedMessageBodyFailure: Malformed message body: Malformed Malformed match
 	at org.http4s.multipart.MultipartParser$.$anonfun$ignorePrelude$2(MultipartParser.scala:209)
 	at fs2.Pull$$anon$1.cont(Pull.scala:149)
 	at fs2.Pull$BindBind$$anon$7.<init>(Pull.scala:622)
 	at fs2.Pull$BindBind.cont(Pull.scala:622)
 	at fs2.Pull$BindBind$$anon$7.cont(Pull.scala:624)
 	at fs2.Pull$.mk$1(Pull.scala:638)
 	at fs2.Pull$.fs2$Pull$$viewL(Pull.scala:643)
 	at fs2.Pull$.fs2$Pull$$go$1(Pull.scala:1118)
 	at fs2.Pull$StepRunR$1.$anonfun$done$2(Pull.scala:884)
 	at fs2.Pull$.$anonfun$compile$1(Pull.scala:805)
 	at cats.effect.IOFiber.next$2(IOFiber.scala:358)
 	at cats.effect.IOFiber.runLoop(IOFiber.scala:366)
 	at cats.effect.IOFiber.autoCedeR(IOFiber.scala:1134)
 	at cats.effect.IOFiber.run(IOFiber.scala:145)
 	at cats.effect.unsafe.WorkerThread.run(WorkerThread.scala:397)

The client code is the same (except from the new Header handling), so I'm not sure if I found a bug or if I should do it differently somehow

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.