Class AbstractHttpResponse
java.lang.Object
com.github.mjeanroy.junit.servers.client.impl.AbstractHttpResponse
- All Implemented Interfaces:
HttpResponse
- Direct Known Subclasses:
DefaultHttpResponse
Abstract skeleton of
HttpResponse
interface.
This abstract class is not part of the public API and should not be used publicly.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractHttpResponse
(long duration) Create the partial HTTP response implementation. -
Method Summary
Modifier and TypeMethodDescriptionbody()
Http response body.protected boolean
Ensure that given object o can be equal to this.boolean
containsHeader
(String name) Check that given header is available.boolean
GetCache-Control
header from http response.GetContent-Encoding
header from http response.GetContent-Security-Policy
header from http response.GetContent-Type
header from http response.Get cookie by its name (if cookie is missing,null
is returned).Get all cookies sent by server.getETag()
GetETag
header from http response.GetLast-Modified
header from http response.GetLocation
header from http response.long
Get duration of request execution in nano seconds.long
Get duration of request execution in milli seconds (shortcut forgetRequestDuration() / 100
).GetStrict-Transport-Security
header from http response.GetX-Content-Security-Policy
header from http response: this header was initially an experimental header implemented in Firefox.GetX-Content-Type-Options
header from http response.GetX-Webkit-CSP
header from http response: this header was initially an experimental header implemented in Webkit browser (Chrome and Safari).GetX-XSS-Protection
header from http response.int
hashCode()
protected abstract String
Read HTTP Response _body as aString
.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.github.mjeanroy.junit.servers.client.HttpResponse
getHeader, getHeaders, status
-
Constructor Details
-
AbstractHttpResponse
protected AbstractHttpResponse(long duration) Create the partial HTTP response implementation.- Parameters:
duration
- Original request duration.
-
-
Method Details
-
getRequestDuration
public long getRequestDuration()Description copied from interface:HttpResponse
Get duration of request execution in nano seconds.- Specified by:
getRequestDuration
in interfaceHttpResponse
- Returns:
- Request execution duration.
-
getRequestDurationInMillis
public long getRequestDurationInMillis()Description copied from interface:HttpResponse
Get duration of request execution in milli seconds (shortcut forgetRequestDuration() / 100
).- Specified by:
getRequestDurationInMillis
in interfaceHttpResponse
- Returns:
- Request execution duration.
- See Also:
-
body
Description copied from interface:HttpResponse
Http response body.- Specified by:
body
in interfaceHttpResponse
- Returns:
- Body.
- See Also:
-
readResponseBody
Read HTTP Response _body as aString
.- Returns:
- The response _body.
- Throws:
IOException
- If an error occurred while reading _body.
-
containsHeader
Description copied from interface:HttpResponse
Check that given header is available.- Specified by:
containsHeader
in interfaceHttpResponse
- Parameters:
name
- Header name.- Returns:
true
if header is in response,false
otherwise.- See Also:
-
getCookie
Description copied from interface:HttpResponse
Get cookie by its name (if cookie is missing,null
is returned).- Specified by:
getCookie
in interfaceHttpResponse
- Parameters:
name
- Cookie name.- Returns:
- Cookie.
- See Also:
-
getCookies
Description copied from interface:HttpResponse
Get all cookies sent by server.- Specified by:
getCookies
in interfaceHttpResponse
- Returns:
- Cookies.
- See Also:
-
getETag
Description copied from interface:HttpResponse
GetETag
header from http response.- Specified by:
getETag
in interfaceHttpResponse
- Returns:
- ETag header.
- See Also:
-
getContentType
Description copied from interface:HttpResponse
GetContent-Type
header from http response.- Specified by:
getContentType
in interfaceHttpResponse
- Returns:
- Content-Type header.
- See Also:
-
getContentEncoding
Description copied from interface:HttpResponse
GetContent-Encoding
header from http response.- Specified by:
getContentEncoding
in interfaceHttpResponse
- Returns:
- Content-Encoding header.
- See Also:
-
getLocation
Description copied from interface:HttpResponse
GetLocation
header from http response.- Specified by:
getLocation
in interfaceHttpResponse
- Returns:
- Location header.
- See Also:
-
getCacheControl
Description copied from interface:HttpResponse
GetCache-Control
header from http response.- Specified by:
getCacheControl
in interfaceHttpResponse
- Returns:
- Cache-Control header.
- See Also:
-
getLastModified
Description copied from interface:HttpResponse
GetLast-Modified
header from http response.- Specified by:
getLastModified
in interfaceHttpResponse
- Returns:
- Last-Modified header.
- See Also:
-
getStrictTransportSecurity
Description copied from interface:HttpResponse
GetStrict-Transport-Security
header from http response.- Specified by:
getStrictTransportSecurity
in interfaceHttpResponse
- Returns:
- Strict-Transport-Security header.
- See Also:
-
getContentSecurityPolicy
Description copied from interface:HttpResponse
GetContent-Security-Policy
header from http response.- Specified by:
getContentSecurityPolicy
in interfaceHttpResponse
- Returns:
- Content-Security-Policy header.
- See Also:
-
getXContentSecurityPolicy
Description copied from interface:HttpResponse
GetX-Content-Security-Policy
header from http response: this header was initially an experimental header implemented in Firefox.- Specified by:
getXContentSecurityPolicy
in interfaceHttpResponse
- Returns:
- X-Content-Security-Policy header.
- See Also:
-
getXWebkitCSP
Description copied from interface:HttpResponse
GetX-Webkit-CSP
header from http response: this header was initially an experimental header implemented in Webkit browser (Chrome and Safari).- Specified by:
getXWebkitCSP
in interfaceHttpResponse
- Returns:
- }X-Content-Security-Policy header.
- See Also:
-
getXContentTypeOptions
Description copied from interface:HttpResponse
GetX-Content-Type-Options
header from http response.- Specified by:
getXContentTypeOptions
in interfaceHttpResponse
- Returns:
- X-Content-Type-Options header.
- See Also:
-
getXXSSProtection
Description copied from interface:HttpResponse
GetX-XSS-Protection
header from http response.- Specified by:
getXXSSProtection
in interfaceHttpResponse
- Returns:
- X-XSS-Protection header.
- See Also:
-
equals
-
hashCode
public int hashCode() -
canEqual
Ensure that given object o can be equal to this.- Parameters:
o
- The HTTP Response.- Returns:
- The flag.
-