Skip to content

Support cookie parameters #1771

@MicahParks

Description

@MicahParks

Description

My OpenAPI specification contains parameters with values are located in cookies. It would be most convenient if this project wrote specified cookies to outgoing requests.

I saw #1689 was closed and wanted an open issue for tracking.

When the openapi-typescript client is running in my Next.js project under a file with "use client" the web browser cookies are sent along 👍

When the openapi-typescript client is running on server side Next.js code, no cookies are sent along with the request, even when specified.

Proposal

Cookies that are specified for a request are written to outgoing requests. If a cookie under that name already exists, it is overwritten if specified. In the case of the openapi-typescript client running under a file with "use client" (in the web browser), supplying the value of null (or similar) for a specified cookie name will allow a type-safe way to convey the meaning "use the web browser's value for this cookie"

Alternatively, docs and an example on how to do this via middleware would be wonderful, I am not very TypeScript savvy.

Checklist

Metadata

Metadata

Assignees

Labels

openapi-fetchRelevant to the openapi-fetch library

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions