-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add cookie to ws #1650
Add cookie to ws #1650
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1650 +/- ##
==========================================
- Coverage 72.16% 72.11% -0.06%
==========================================
Files 166 166
Lines 12787 12802 +15
==========================================
+ Hits 9228 9232 +4
- Misses 3009 3020 +11
Partials 550 550
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution! I left some minor comments, but we should also have a unit test or two for this change.
Codecov Report
@@ Coverage Diff @@
## master #1650 +/- ##
==========================================
- Coverage 72.16% 72.13% -0.04%
==========================================
Files 166 166
Lines 12787 12840 +53
==========================================
+ Hits 9228 9262 +34
- Misses 3009 3022 +13
- Partials 550 556 +6
Continue to review full report at Codecov.
|
@imiric hello. I rewrite it to use cookie object |
Codecov Report
@@ Coverage Diff @@
## master #1650 +/- ##
==========================================
- Coverage 72.16% 72.13% -0.04%
==========================================
Files 166 166
Lines 12787 12840 +53
==========================================
+ Hits 9228 9262 +34
- Misses 3009 3022 +13
- Partials 550 556 +6
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #1650 +/- ##
==========================================
- Coverage 72.16% 72.15% -0.01%
==========================================
Files 166 166
Lines 12787 12840 +53
==========================================
+ Hits 9228 9265 +37
- Misses 3009 3019 +10
- Partials 550 556 +6
Continue to review full report at Codecov.
|
} | ||
|
||
cookiesMap := make(map[string]http.Cookie) | ||
for _, cookie := range state.CookieJar.Cookies(u) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we write the cookiesMap
changes back to state.CookieJar
? cc: @mstoykov
And I think @mstoykov would like to reuse the cookie logic in the httpext
package, e.g. SetRequestCookies
, though we should probably agree on the details.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the websocket docs it looks like reusing it will be ... harder than I expected ... read ... not possible unless we rewrite it which won't help at all either way.
Looking at the httpext k6 does write back only stuff that were set in the responses
Thanks for the changes @lcd1232. Would you mind rebasing this branch on the current |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lcd1232 Are you still available to wrap up this PR? We'd like to merge it for v0.33.0 as the code LGTM besides the test comment, but it would need rebasing since there have been a lot of changes in the past 7 months (though few related to WS, so there are no conflicts), and you'll need to change the test to use rt.RunString()
instead of common.RunString()
since we dropped our wrapper.
If we don't hear from you in the next few days or you're not available anymore, that's OK too, and we can continue and merge it ourselves. You would of course be credited in our release notes ;)
t.Run("client_cookie", func(t *testing.T) { | ||
_, err := common.RunString(rt, sr(` | ||
var params = { | ||
cookies: { "Session": "123" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also have a test for when the value is an object and uses replace
.
Closes #1226.
Add header
Cookie
which allows sending cookies to WebSocket.