HTTPClient Documentation
*** Settings ***
Library HTTPClient
*** Test Cases ***
Example
[Documentation] Demonstrates using HTTPClient
# add your keyword calls here
Introduction
HTTP client library for Robot Framework.
This library provides keywords for:
- Making HTTP requests (GET, POST, PUT, DELETE)
- Handling HTTP responses
- Working with JSON APIs
- Managing headers and authentication
- Response validation
Arguments
Return Type
Dict[str, Any]Documentation
Perform HTTP GET request.
Arguments:
url: Target URLheaders: Optional dictionary of HTTP headers
Returns: Response dictionary with status, headers, and body
Example:
*** Settings *** Library HTTPClient *** Test Cases *** HTTP GET Example ${response} Http Get https://api.example.com/users Should Be Equal As Integers ${response}[status] 200
Arguments
Return Type
Dict[str, Any]Documentation
Perform HTTP POST request.
Arguments:
url: Target URLdata: Request body data (dictionary)headers: Optional dictionary of HTTP headers
Returns: Response dictionary with status, headers, and body
Example:
*** Settings *** Library HTTPClient *** Test Cases *** HTTP POST Example ${data} Create Dictionary name=John email=john@example.com ${response} Http Post https://api.example.com/users ${data} Response Should Be Success ${response}
Arguments
Return Type
Dict[str, Any]Documentation
Perform HTTP PUT request.
Arguments:
url: Target URLdata: Request body data (dictionary)headers: Optional dictionary of HTTP headers
Returns: Response dictionary with status, headers, and body
Arguments
Return Type
Dict[str, Any]Documentation
Perform HTTP DELETE request.
Arguments:
url: Target URLheaders: Optional dictionary of HTTP headers
Returns: Response dictionary with status, headers, and body
Arguments
Documentation
Set a default header for all subsequent requests.
Arguments:
name: Header namevalue: Header value
Example:
*** Settings *** Library HTTPClient *** Test Cases *** Set Header Example Set Header Authorization Bearer token123 Set Header Content-Type application/json ${response} Http Get https://api.example.com/data
Documentation
Clear all default headers.
Arguments
Return Type
intDocumentation
Extract HTTP status code from response.
Arguments:
response: Response dictionary from HTTP request
Returns: HTTP status code
Arguments
Return Type
Dict[str, Any]Documentation
Extract response body from HTTP response.
Arguments:
response: Response dictionary from HTTP request
Returns: Response body as dictionary
Arguments
Documentation
Verify that HTTP response status is success (2xx).
Arguments:
response: Response dictionary from HTTP request
Raises: AssertionError if status is not 2xx
Arguments
Return Type
Dict[str, Any]Documentation
Parse JSON response body.
Arguments:
response: Response dictionary from HTTP request
Returns: Parsed JSON as dictionary
Arguments
Return Type
strDocumentation
Build URL query string from parameters.
Arguments:
params: Dictionary of query parameters
Returns: Query string (e.g., "key1=value1&key2=value2")
Example:
*** Settings *** Library HTTPClient *** Test Cases *** Build Query String Example ${params} Create Dictionary page=1 limit=10 ${query} Build Query String ${params} Should Be Equal ${query} page=1&limit=10
Arguments
Documentation
Set Basic Authentication header.
Arguments:
username: Username for authenticationpassword: Password for authentication
Example:
*** Settings *** Library HTTPClient *** Test Cases *** Set Basic Auth Example Set Basic Auth admin secret123 ${response} Http Get https://api.example.com/protected
Arguments
Documentation
Set Bearer token authentication header.
Arguments:
token: Bearer token string
Example:
*** Settings *** Library HTTPClient *** Test Cases *** Set Bearer Token Example Set Bearer Token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... ${response} Http Get https://api.example.com/data
Need Help?
Found an issue or have a feature request for this library? Let the maintainers know by opening a new GitHub issue. Please include environment details and relevant log output to help us reproduce the problem.