---
Suite
---

Changing http test's HTTP handling can be done via 'http client setup'.
But one should always be careful that changing the client handling lasts until you change it again, if it is not
changed explicitly the changes will last for all subsequent tests until the end of the run. To prevent such side effects
this suite uses a >SuiteSetUp to store the original client and >TearDown to restore this after each test.

>HttpCompressionViaSetup shows an example GET request with gzip compression support.
>HttpsWithoutCertificateVerificationViaSetup shows example GET requests without SSL certificate verification

Other configuration changes that can be achieved are explicitly setting a trust store determining which certificates are trusted
and sending specific client certificates with requests (to achieve two sided authentication).

!2 Language

!3 !-HttpClientSetup-!
The main commands/keywords (i.e. public methods) offered by !-nl.hsac.fitnesse.fixture.slim.HttpClientSetup-! are listed below.

-|Comment                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
|enable compression                                                                                                           |Enables content compression support (i.e. gzip) for all subsequent requests until the end of the test run                                                                                                                                                                                                                                                                                                                |
|disable SSL verification                                                                                                     |Use at your own risk! Disables SSL certificate verification for all subsequent requests until the end of the test run. This makes https potentially as unsafe as http!                                                                                                                                                                                                                                                   |
|connection timeout <timeout> milliseconds                                                                                    |Determines the timeout in milliseconds until a connection is established                                                                                                                                                                                                                                                                                                                                                 |
|socket timeout <timeout> milliseconds                                                                                        |Defines the socket timeout in milliseconds, which is the maximum period of inactivity between two consecutive data packets                                                                                                                                                                                                                                                                                               |
|set proxy <proxy:port>                                                                                                       |use the supplied proxy server                                                                                                                                                                                                                                                                                                                                                                                            |
|set proxy username <user name> and password <password>                                                                       |use the supplied username and password to authenticate to the proxy                                                                                                                                                                                                                                                                                                                                                      |
|set trust store <trust store file> with password <trust store password>                                                      |trust hosts using the Java trust store (i.e. .jks) 'trust store file'                                                                                                                                                                                                                                                                                                                                                    |
|set client certificate from <key store file> with password <key store password> key password <key password>                  |send the client certificate from the Java key store (i.e. .jks) 'key store file'                                                                                                                                                                                                                                                                                                                                         |
|set client certificate from <key store file> with password <key store password> key password <key password> and alias <alias>|send client certificate 'alias' from the Java key store (i.e. .jks) 'key store file'                                                                                                                                                                                                                                                                                                                                     |
|use windows authentication <true/false>                                                                                      |configure the http client to use Windows credentials. '''This is only available on Windows.''' It will throw an exception when used on a non-windows platform. If set, request authentication can still be overridden by setting the appropriate authorization header in Http Test. ''Note'': when using Windows authentication and a proxy server, it is not possible to use different credentials for the proxy server.|
|configure request username <username> and password <password>                                                                |configure the http client with a ''default'' Basic auth credential using given username and password. Effectively rendering manual creation of an authorization header in Http Test unnecessary. This default authorization setting that can be overridden in Http Test by setting the authorization header for a request.                                                                                               |
|configure http test                                                                                                          |configures subsequent http test usage to use the current client configuration                                                                                                                                                                                                                                                                                                                                            |
|get original client                                                                                                          |returns the http client at the moment this http client setup instance was created, so it may be stored in a Slim symbol to be restored later                                                                                                                                                                                                                                                                             |
|configure http test with <client symbol>                                                                                     |configures subsequent http test usage to use the client configuration as stored previously in the Slim symbol 'client symbol'                                                                                                                                                                                                                                                                                            |

!contents -R2 -g -p -f -h
