Knows Not Much Knows Not Much - 5 months ago 35
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?


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