Skip to content

Commit

Permalink
Adding raw variants of RequestSpec functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Sytten committed Nov 12, 2024
1 parent d9f1b24 commit 31a42c7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/quickjs-types/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@caido/quickjs-types",
"version": "0.12.0",
"version": "0.13.0",
"description": "Typing for the QuickJS Engine",
"author": "Caido Labs Inc. <[email protected]>",
"license": "MIT",
Expand Down
15 changes: 12 additions & 3 deletions packages/quickjs-types/src/caido/requests.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,28 +211,37 @@ declare module "caido:utils" {
setTls(tls: boolean): void;
/**
* Get the HTTP method of the request.
*
* Get the raw version by passing `{ raw: true }` in the options.
*/
getMethod(): string;
getMethod(options: RawOption): Uint8Array;
/**
* Set the HTTP method of the request.
*
* All strings are accepted.
*/
setMethod(method: string): void;
setMethod(method: Bytes): void;
/**
* Get the path of the request.
*
* Get the raw version by passing `{ raw: true }` in the options.
*/
getPath(): string;
getPath(options: RawOption): Uint8Array;
/**
* Set the path of the request.
*/
setPath(path: string): void;
setPath(path: Bytes): void;
/**
* Get the unparsed query of the request.
*
* Get the raw version by passing `{ raw: true }` in the options.
*
* Excludes the leading `?`.
*/
getQuery(): string;
getQuery(options: RawOption): Uint8Array;
/**
* Set the unparsed query of the request.
*
Expand All @@ -243,7 +252,7 @@ declare module "caido:utils" {
* spec.setQuery("q=hello");
* ```
*/
setQuery(query: string): void;
setQuery(query: Bytes): void;
/**
* The headers of the request.
*
Expand Down
5 changes: 5 additions & 0 deletions packages/quickjs-types/src/caido/shared.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,9 @@ declare module "caido:utils" {
* @category Shared
*/
export type MaybePromise<T> = T | Promise<T>;
/**
* Option to return raw value
* @category Shared
*/
export type RawOption = { raw: true };
}

0 comments on commit 31a42c7

Please sign in to comment.