LLClient: Add setJsonEntity (#30447)

Adds `Request#setJsonEntity(String)` which short circuits the process of
sending a json string which is super common.
This commit is contained in:
Nik Everett 2018-05-09 18:33:03 -04:00 committed by GitHub
parent 9828e11709
commit b4502dbf74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 52 additions and 11 deletions

View file

@ -263,6 +263,14 @@ IMPORTANT: The `ContentType` specified for the `HttpEntity` is important
because it will be used to set the `Content-Type` header so that Elasticsearch
can properly parse the content.
You can also set it to a `String` which will default to
a `ContentType` of `application/json`.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/RestClientDocumentation.java[rest-client-body-shorter]
--------------------------------------------------
And you can set a list of headers to send with the request:
["source","java",subs="attributes,callouts,macros"]