Scenario is not replaying set cookies
See original GitHub issueI’m currently running 1.6.0-23.
I am assuming I am just misunderstanding something but I can’t get auth cookies that the server is setting to be replayed by subsequent requests later in the scenario. When a user successfully logs into our api we return an HttpOnly
cookie called Fuze
. So I have the following configuration:
config:
payload:
path: "logins.csv"
fields:
- "username"
- "password"
phases:
- duration: 300
arrivalRate: 1
scenarios:
- name: "Test"
flow:
- post:
url: "/login"
json:
Email: "{{ username }}"
Password: "{{ password }}"
- get:
url: "/message/get-message-count"
With debug output I"m getting the following:
\ http request: {
"url": "http://localhost:46551/login",
"method": "POST",
"headers": {
"user-agent": "Artillery (https://artillery.io)"
},
"json": {
"Email": "dev",
"Password": "xxx"
}
} +807ms
http:response {
http:response "cache-control": "no-cache",
http:response "pragma": "no-cache",
http:response "content-type": "application/json; charset=utf-8",
http:response "expires": "-1",
http:response "server": "Microsoft-IIS/10.0",
http:response "unauthenticateduser": "true",
http:response "x-aspnet-version": "4.0.30319",
http:response "set-cookie": [
http:response "Fuze=66DEF75C1CFA4A5691E24A4D37BA7AFF837C5A9F6BC255BAA25DA894080720F6C6C12917FAB059C3D0DB80A204E9FAEB9F95860B30D37C807A66ECAB5747ADD788E3AE01D1F608DCE473933779BA060670B9B1915363EAD7073A94A0C1D0E5A0FDEEA5E45720E3B38EE155E9718C91A6A11084CED1BE5D67ABF00F61E21AB1C10BD1DF71076112F590F767EC57B7E510100C6824FC73C14ED54E60CC70800A6B15A7ACCA; domain=localhost; expires=Tue, 11-Sep-2018 22:36:22 GMT; path=/; HttpOnly",
http:response "profile=29; domain=localhost; path=/; HttpOnly"
http:response ],
http:response "x-sourcefiles": "=?UTF-8?B?QzpcY29kZVx3b3JrXGNhcmVzdGFja1xDYXJlU3RhY2suVW5pZmllZC5tc2hhcGlyb1xDYXJlU3RhY2suQmFja2VuZFxDYXJlU3RhY2suV2ViXGxvZ2lu?=",
http:response "x-powered-by": "ASP.NET",
http:response "date": "Tue, 11 Sep 2018 22:00:21 GMT",
http:response "content-length": "42"
http:response } +1ms
http:response {
http:response "Version": "v2.7.0",
http:response "IsLoginSuccess": true
http:response } +16ms
http captures and matches: +2ms
http {} +1ms
http {} +2ms
http request: {
"url": "http://localhost:46551/message/get-message-count",
"method": "GET",
"headers": {
"user-agent": "Artillery (https://artillery.io)"
}
} +14ms
http:response {
http:response "cache-control": "no-cache",
http:response "pragma": "no-cache",
http:response "content-type": "application/json; charset=utf-8",
http:response "expires": "-1",
http:response "server": "Microsoft-IIS/10.0",
http:response "unauthenticateduser": "true",
http:response "x-aspnet-version": "4.0.30319",
http:response "x-sourcefiles": "=?UTF-8?B?QzpcY29kZVx3b3JrXGNhcmVzdGFja1xDYXJlU3RhY2suVW5pZmllZC5tc2hhcGlyb1xDYXJlU3RhY2suQmFja2VuZFxDYXJlU3RhY2suV2ViXG1lc3NhZ2VcZ2V0LW1lc3NhZ2UtY291bnQ=?=",
http:response "x-powered-by": "ASP.NET",
http:response "date": "Tue, 11 Sep 2018 22:00:21 GMT",
http:response "content-length": "61"
http:response } +1ms
http:response "{\"Message\":\"Authorization has been denied for this request.\"}" +2ms
http captures and matches: +8ms
http {} +2ms
http {} +1ms
From this it shows artillery submitting a request to /login
and the server response containing a Fuze
cookie. However the next request in the same scenario shows no cookies being sent which results in a 401 being returned (which is expected when not logged in).
Reading the documentation shows
Cookies are remembered and re-used by individual virtual users.
This makes me think that any cookie that the server sets should be automatically replayed by Artillery. Am I missing something?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:16 (8 by maintainers)
Top GitHub Comments
hi @johnoraclestites 👋 that behavior is indeed expected. cookies would be considered virtual user-specific data and as such do not get passed from a
before
block to individual VUs.using version 2.0, I have an authentication post request in a scenario that is correctly saving and replaying the returned cookie for all subsequent requests in the flow, but if I move that authentication post to the
before
section of the overall script, the cookies are not sent. is this expected?