forked from karatelabs/karate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
redirect.feature
50 lines (41 loc) · 1.26 KB
/
redirect.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Feature: disable redirects in order to assert against the location header
Background:
* url demoBaseUrl
Scenario: get redirects are followed by default
Given path 'redirect'
And param foo = 'bar'
When method get
Then status 200
And match response == { foo: ['bar'] }
Scenario: get redirects can be disabled
* configure followRedirects = false
Given path 'redirect'
When method get
Then status 302
And match header Location == demoBaseUrl + '/search'
* def location = responseHeaders['Location'][0]
Given url location
And param foo = 'bar'
When method get
Then status 200
And match response == { foo: ['bar'] }
Scenario: post redirects are followed by default
Given path 'redirect'
And param foo = 'bar'
And request {}
When method post
Then status 200
And match response == { foo: ['bar'] }
Scenario: post redirects can be disabled
* configure followRedirects = false
Given path 'redirect'
And request {}
When method post
Then status 302
And match header Location == demoBaseUrl + '/search'
* def location = responseHeaders['Location'][0]
Given url location
And param foo = 'bar'
When method get
Then status 200
And match response == { foo: ['bar'] }