Skip to content

Make it easy to send and receive HTTP requests with JSON bodies

License

Notifications You must be signed in to change notification settings

koron-go/jsonhttpc

Repository files navigation

JSON-specialized HTTP client

PkgGoDev Actions/Go Go Report Card

Package jsonhttpc provides a way to easily send and receive HTTP requests with JSON bodies.

  • Request and response is encoded/decoded as JSON automatically.
  • Bit handy for repeating requests.
    • specify base URL - WithBaseURL()
    • specify HTTP Client - WithClient()
    • specify HTTP header - WithHeader()
  • Tips to customize requests - for Do()
    • ContentType() string on body overrides "Content-Type" header. (default is "application/json")
  • Responses are automatically JSON-decoded even in case of errors - Error

(Japanese)

  • リクエストとレスポンスは自動的にJSONエンコード/デコードされます
  • リクエストを繰り返し行うのに少し便利です
    • ベースURLを設定できる WithBaseURL()
    • HTTP Clientを設定できる WithClient()
    • ヘッダーを設定できる WithHeader()
  • リクエストをカスタマイズするtipsがあります - for Do()
    • bodyContentType() string を実装するとContent-Typeヘッダーを変更 できます (デフォルトは application/json)
  • エラーの際もレスポンスは自動的にJSONデコードされます

Install and update

$ go get github.com/koron-go/jsonhttpc@latest

How to use

About

Make it easy to send and receive HTTP requests with JSON bodies

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published