Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a body serialiser for JSON AST types #1862

Closed
adamw opened this issue Jun 20, 2023 · 1 comment
Closed

Create a body serialiser for JSON AST types #1862

adamw opened this issue Jun 20, 2023 · 1 comment

Comments

@adamw
Copy link
Member

adamw commented Jun 20, 2023

E.g. for ujson.Obj, so that in the example in https://scala-lang.org/blog/2023/06/20/toolkit.html we could do simply .body(ujson) instead of

  .header("Content-Type", "application/json")
  .body(ujson.write(json))

Should be the same for other JSON libs

@adamw
Copy link
Member Author

adamw commented Jul 24, 2023

@szymon-rd turns out this has worked all along :) so just doing .body(ujson) should do the trick, without having to specify the content type manually or invoking .write. Provided, of coure, the the ujson+sttp import is in place: import sttp.client4.upicklejson._

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant