Constructor and Description |
---|
EncoderConfig()
Configure the encoder config to use "ISO-8859-1" for content encoding and
UTF-8 . |
EncoderConfig(String defaultContentCharset,
String defaultQueryParameterCharset) |
Modifier and Type | Method and Description |
---|---|
EncoderConfig |
and()
Syntactic sugar.
|
EncoderConfig |
appendDefaultContentCharsetToContentTypeIfUndefined(boolean shouldAddDefaultContentCharsetToContentTypeIfMissing)
Tells whether REST Assured should automatically append the content charset to the content-type header if not defined explicitly.
|
Map<String,ContentType> |
contentEncoders() |
EncoderConfig |
defaultCharsetForContentType(Charset charset,
ContentType contentType)
Specify the default charset to use for the specific content-type if it's not specified in the content-type header explicitly
|
EncoderConfig |
defaultCharsetForContentType(Charset charset,
String contentType)
Specify the default charset to use for the specific content-type if it's not specified in the content-type header explicitly
|
String |
defaultCharsetForContentType(ContentType contentType) |
String |
defaultCharsetForContentType(String contentType) |
EncoderConfig |
defaultCharsetForContentType(String charset,
ContentType contentType)
Specify the default charset to use for the specific content-type if it's not specified in the content-type header explicitly
|
EncoderConfig |
defaultCharsetForContentType(String charset,
String contentType)
Specify the default charset to use for the specific content-type if it's not specified in the content-type header explicitly
|
String |
defaultContentCharset() |
EncoderConfig |
defaultContentCharset(Charset charset)
Specify the default charset for the body/content in the request specification
|
EncoderConfig |
defaultContentCharset(String charset)
Specify the default charset for the body/content in the request specification
|
String |
defaultQueryParameterCharset() |
EncoderConfig |
defaultQueryParameterCharset(Charset charset)
Specify the default charset for query parameters
|
EncoderConfig |
defaultQueryParameterCharset(String charset)
Specify the default charset for query parameters
|
EncoderConfig |
encodeContentTypeAs(String contentType,
ContentType encoder)
Encodes the content (body) of the request specified with the given
contentType with the same
encoder used by the supplied encoder . |
static EncoderConfig |
encoderConfig() |
boolean |
hasContentEncoders() |
boolean |
hasDefaultCharsetForContentType(String contentType) |
boolean |
isUserConfigured() |
boolean |
shouldAppendDefaultContentCharsetToContentTypeIfUndefined()
Tells whether REST Assured should automatically append the content charset to the content-type header if not defined explicitly.
|
public EncoderConfig()
UTF-8
.
for query parameter encoding.
The reason for choosing UTF-8 as default for query parameters even though US-ASCII is standard according to the URI Syntax specification is that it's nowadays recommended by w3 to use UTF-8. Different web servers seem to take different approaches though, for example Jetty uses UTF-8 as default but Tomcat uses US-ASCII. Since REST Assured is a test framework first and Jetty is more popular for testing REST Assured uses UTF-8.
public String defaultCharsetForContentType(String contentType)
defaultContentCharset()
.public String defaultCharsetForContentType(ContentType contentType)
defaultContentCharset()
.public boolean hasDefaultCharsetForContentType(String contentType)
defaultContentCharset()
.public String defaultContentCharset()
defaultCharsetForContentType(String)
.public String defaultQueryParameterCharset()
public EncoderConfig defaultCharsetForContentType(String charset, String contentType)
charset
- The charset to use as default (unless specified explicitly)contentType
- The content-typeEncoderConfig
public EncoderConfig defaultCharsetForContentType(String charset, ContentType contentType)
charset
- The charset to use as default (unless specified explicitly)contentType
- The content-typeEncoderConfig
public EncoderConfig defaultCharsetForContentType(Charset charset, ContentType contentType)
charset
- The charset to use as default (unless specified explicitly)contentType
- The content-typeEncoderConfig
public EncoderConfig defaultCharsetForContentType(Charset charset, String contentType)
charset
- The charset to use as default (unless specified explicitly)contentType
- The content-typeEncoderConfig
public EncoderConfig defaultContentCharset(Charset charset)
charset
- The charset to use.EncoderConfig
public EncoderConfig defaultQueryParameterCharset(String charset)
charset
- The charset to use.EncoderConfig
public EncoderConfig defaultQueryParameterCharset(Charset charset)
charset
- The charset to use.EncoderConfig
public EncoderConfig defaultContentCharset(String charset)
charset
- The charset to use.EncoderConfig
public EncoderConfig appendDefaultContentCharsetToContentTypeIfUndefined(boolean shouldAddDefaultContentCharsetToContentTypeIfMissing)
Note that this does not affect multipart form data.
Default is true
.
shouldAddDefaultContentCharsetToContentTypeIfMissing
- Whether REST Assured should automatically append the content charset to the content-type header if not defined explicitly.EncoderConfig
instancepublic boolean shouldAppendDefaultContentCharsetToContentTypeIfUndefined()
Note that this does not affect multipart form data.
true
if REST Assured should automatically append the content charset to the content-type header if not defined explicitly.public static EncoderConfig encoderConfig()
public EncoderConfig and()
public boolean isUserConfigured()
isUserConfigured
in interface Config
true
if this config instance has been explicitly configured by the user, false
if it has the default values.public boolean hasContentEncoders()
encodeContentTypeAs(String, ContentType)
public Map<String,ContentType> contentEncoders()
encodeContentTypeAs(String, ContentType)
public EncoderConfig encodeContentTypeAs(String contentType, ContentType encoder)
contentType
with the same
encoder used by the supplied encoder
. This is useful only if REST Assured picks the wrong
encoder (or can't recognize it) for the given content-type.contentType
- The content-type to encode with a specific encoder.encoder
- The encoder to use for the given content-type.EncoderConfig
instanceCopyright © 2010–2017. All rights reserved.