Skip to content
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

feat(http): added cookie helpers #586

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alpharder
Copy link
Contributor

Summary of changes

/**
 * Marks a parameter as HTTP cookie and reads the value from the request 'Cookie' header.
 *
 * @example
 * ```typescript
 * class Controller {
 *    @http.GET('/api')
 *    route(session: HttpCookie<string>) {
 *         //authorization is string and required
 *         //use `session?: HttpCookie<string>` to make it optional
 *    }
 * }
 *
 * // curl /api -H 'Cookie: session=123'
 * ```
 *
 * To change the cookie name, use `param: HttpCookie<string, {name: 'cookieName'}>`.
 */
export type HttpCookie<T, Options extends { name?: string } = {}> = T & TypeAnnotation<'httpCookie', Options>;

Relinquishment of Rights

Please mark following checkbox to confirm that you relinquish all rights of your changes:

  • I waive and relinquish all rights regarding this changes (including code, text, and images) to Deepkit UG (limited), Germany. This changes (including code, text, and images) are under MIT license without name attribution, copyright notice, and permission notice requirement.

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.

None yet

1 participant