Skip to content

Commit

Permalink
🤖 Merge PR DefinitelyTyped#59456 K6 v0.37 by @ppcano
Browse files Browse the repository at this point in the history
* k6 v0.37: bump version

* k6 v0.37: add `http.head` method

* k6 0.37: update list of maintainers

* Trigger GitHub actions
  • Loading branch information
Pepe Cano authored Mar 29, 2022
1 parent fbf9c36 commit 9bd3cb2
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 4 deletions.
28 changes: 28 additions & 0 deletions types/k6/http.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@ export function del<RT extends ResponseType | undefined>(
params?: RefinedParams<RT> | null
): RefinedResponse<RT>;

/**
* Make HEAD request.
* https://k6.io/docs/javascript-api/k6-http/head-url-params/
* @param url - Request URL.
* @param params - Request parameters.
* @returns Resulting response.
* @example
* http.head('https://test.k6.io')
*/
export function head<RT extends ResponseType | undefined>(
url: string | HttpURL,
params?: RefinedParams<RT> | null
): RefinedResponse<RT>;

/**
* Make GET request.
* https://k6.io/docs/javascript-api/k6-http/get-url-params
Expand Down Expand Up @@ -764,6 +778,20 @@ declare namespace http {
params?: RefinedParams<RT> | null
): RefinedResponse<RT>;

/**
* Make HEAD request.
* https://k6.io/docs/javascript-api/k6-http/head-url-params/
* @param url - Request URL.
* @param params - Request parameters.
* @returns Resulting response.
* @example
* http.head('https://test.k6.io')
*/
function head<RT extends ResponseType | undefined>(
url: string | HttpURL,
params?: RefinedParams<RT> | null
): RefinedResponse<RT>;

/**
* Make GET request.
* https://k6.io/docs/javascript-api/k6-http/get-url-params/
Expand Down
7 changes: 3 additions & 4 deletions types/k6/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
// Type definitions for k6 0.36
// Type definitions for k6 0.37
// Project: https://k6.io/docs/
// Definitions by: na-- <https://github.com/na-->
// Ivan Mirić <https://github.com/imiric>
// Mihail Stoykov <https://github.com/MStoykov>
// Ivan <https://github.com/codebien>
// Inanc Gumus <https://github.com/inancgumus>
// yorugac <https://github.com/yorugac>
// Théo Crevon <https://github.com/oleiade>
// Oleg Bespalov <https://github.com/olegbespalov>
// Pepe Cano <https://github.com/ppcano>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.4
Expand Down
13 changes: 13 additions & 0 deletions types/k6/test/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import http, {
Response,
ResponseType,
del,
head,
get,
options,
patch,
Expand Down Expand Up @@ -58,6 +59,18 @@ del(address, {}, 5); // $ExpectError
responseBinary = del(address, null, { responseType: 'binary' });
del(address, {}, {}, 5); // $ExpectError

// head
head(); // $ExpectError
head(5); // $ExpectError
head(addressFromHttpURL);
responseDefault = head(address);
head(address, 5); // $ExpectError
responseDefault = head(address, {});
responseBinary = head(address, { responseType: 'binary' });
responseNone = head(address, { responseType: 'none' });
responseText = head(address, { responseType: 'text' });
head(address, {}, 5); // $ExpectError

// get
get(); // $ExpectError
get(5); // $ExpectError
Expand Down

0 comments on commit 9bd3cb2

Please sign in to comment.