-
Notifications
You must be signed in to change notification settings - Fork 982
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cookieJar): Change cookie.get to directly return value (#10493)
- Loading branch information
Showing
5 changed files
with
29 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
- feat(cookieJar): Change cookie.get to directly return value (#10493) by @dac09 | ||
|
||
**Motivation** | ||
My original design of the `CookeiJar.get` would return the full cookie object we store, including cookie options. This is not ideal because you need to access the cookie like this: | ||
|
||
```js | ||
const myCookie = mwRequest.cookies.get('myCookie') | ||
|
||
// 👇 | ||
const actualValue = myCookie.value | ||
``` | ||
|
||
This is unwieldy, and feels unergonomic for the 98% of cases where `get` will be used to just see the value. | ||
|
||
**How do I still see the options of the cookie?** | ||
You can still access all the details of the cookie by doing `cookie.entries`. I don't really have a case for this yet, so let's not optimise for this case, but we know it's possible! | ||
|
||
|
||
This is me just stabilizing the API for Middleware stuff, before we ship it out of experimental |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters