Knows Not Much Knows Not Much - 1 year ago 184
Scala Question

https4s how to make a POST call to a REST web service

I am trying to use the http4s library. I am trying to make a POST request to a REST web service with some json payload.

when I read the documentation I can only see a GET method example.

does anyone know how to make a POST?

Answer Source

It looks like the get/getAs methods mentioned in the example are just convenience wrappers for the fetch method. See

Use the Request constructor and pass Method.POST as the method.

fetch(Request(Method.POST, uri))
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download