Skip to content

fix: deprecate parse, serialize exports for more useful functions#14

Merged
hf merged 1 commit into
mainfrom
hf/fix-deprecate-parse-serialize-exports
Jun 20, 2024
Merged

fix: deprecate parse, serialize exports for more useful functions#14
hf merged 1 commit into
mainfrom
hf/fix-deprecate-parse-serialize-exports

Conversation

@hf
Copy link
Copy Markdown
Collaborator

@hf hf commented Jun 13, 2024

parse, serialize from cookie were exported as-is. That's not super useful for importing outside of the library, so they're deprecated and in their stead adding parseCookieHeader, serializeCookieHeader which works with the getAll, setAll cookie methods more ergonomically.

For example, instead of:

getAll() {
  const parsed = parse(request.headers.get('Cookie') ?? '')
  return Object.keys(parsed).map((name) => ({ name, value: parsed[name] }))
}

You can just use:

getAll() {
  return parseCookieHeader(req.headers.get('Cookie') ?? '')
}

@hf hf merged commit 0b5f881 into main Jun 20, 2024
@hf hf deleted the hf/fix-deprecate-parse-serialize-exports branch June 20, 2024 08:25
hf pushed a commit that referenced this pull request Jun 24, 2024
🤖 I have created a release *beep* *boop*
---


## [0.4.0](v0.3.0...v0.4.0)
(2024-06-24)


### Features

* full rewrite using `getAll` and `setAll` cookie methods
([#1](#1))
([b6ae192](b6ae192))


### Bug Fixes

* allow use of `createBrowserClient` without `window` present
([#20](#20))
([27d868d](27d868d))
* deprecate `parse`, `serialize` exports for more useful functions
([#14](#14))
([0b5f881](0b5f881))
* fix `createBrowserClient` deprecation tsdoc
([#17](#17))
([1df70ad](1df70ad))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants