HTTP
Browse implementations
How to request a secured service
For all HTTP actions, authentication or secured connexion to a service is configured by setting properties on the target.
-
Basic Authentication:
- To use a basic authorization header, set properties
username
and password
on the target.
-
SSL:
- To use an SSL context, set a
keystore
or truststore
one the target.
Properties keystore
, keystorePassword
, keyPassword
, truststore
and truststorePassword
could be alternatively used.
-
Proxy, 2 solutions:
- You can set a system property http.proxyHost or https.proxyHost, the HTTP client will use this as the default route planner.
- You can set a target property
proxy
- Default port value is 3128.
- Target property
proxy
override system property if set
Http target example |
---|
| {
"name": "ghibli_movies_http_service",
"url": "https://my.http.service:443/",
"properties": {
"username": "myUsername",
"user": "myUsername", // (1)
"userPassword": "myPassword",
"password": "myPassword", // (2)
"trustStore": "/home/APP/security/mytruststore.jks",
"trustStorePassword": "myTrustStorePassword",
"keyStore": "/home/APP/security/mykeyStore.jks",
"keyStorePassword": "mykeyStorePassword",
"keyPassword": "myKeyStoreKeyPassword",
"proxy": "https://myproxy:3128"
}
}
|
username
or user
to define user for basic authentification
userPassword
or password
to define password for basic authentification
Get
Example
Post
Example
Put
Example
Delete
Example
Patch
Example
Mocking an HTTP Server
Start
Example
Note
This action automatically registers a teardown to stop the server at the end of the scenario.
Listened routes
This actions allows you to check which requests have been received by a wiremock server.
Available verbs are : GET
, POST
, PUT
, DELETE
, PATCH
, OPTIONS
, HEAD
, TRACE
, ANY
Warning
If this action succeeds, requests will be removed from the Wiremock server.
Example