From 580e3c459f23ff206e764d4b54de3f5a204a09d1 Mon Sep 17 00:00:00 2001 From: devhl Date: Sun, 29 Sep 2024 21:20:24 -0400 Subject: [PATCH] build samples --- .../builds/null-types-simple/.gitattributes | 8 ++++++++ .../null-types-simple/.openapi-generator/FILES | 1 + .../builds/null-types-simple/http/http.ts | 14 ++++++++------ 3 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 samples/client/others/typescript/builds/null-types-simple/.gitattributes diff --git a/samples/client/others/typescript/builds/null-types-simple/.gitattributes b/samples/client/others/typescript/builds/null-types-simple/.gitattributes new file mode 100644 index 000000000000..7bf5a17b22f1 --- /dev/null +++ b/samples/client/others/typescript/builds/null-types-simple/.gitattributes @@ -0,0 +1,8 @@ +**/* linguist-generated +*.md linguist-documentation + +.gitattributes text +.gitattributes export-ignore + +.gitignore text +.gitignore export-ignore diff --git a/samples/client/others/typescript/builds/null-types-simple/.openapi-generator/FILES b/samples/client/others/typescript/builds/null-types-simple/.openapi-generator/FILES index aaf21969459a..f586694f5f67 100644 --- a/samples/client/others/typescript/builds/null-types-simple/.openapi-generator/FILES +++ b/samples/client/others/typescript/builds/null-types-simple/.openapi-generator/FILES @@ -1,3 +1,4 @@ +.gitattributes .gitignore README.md apis/baseapi.ts diff --git a/samples/client/others/typescript/builds/null-types-simple/http/http.ts b/samples/client/others/typescript/builds/null-types-simple/http/http.ts index f38a52ec1300..b0d0d479e219 100644 --- a/samples/client/others/typescript/builds/null-types-simple/http/http.ts +++ b/samples/client/others/typescript/builds/null-types-simple/http/http.ts @@ -33,6 +33,8 @@ export class HttpException extends Error { */ export type RequestBody = undefined | string | FormData | URLSearchParams; +type Headers = Record; + function ensureAbsoluteUrl(url: string) { if (url.startsWith("http://") || url.startsWith("https://")) { return url; @@ -44,7 +46,7 @@ function ensureAbsoluteUrl(url: string) { * Represents an HTTP request context */ export class RequestContext { - private headers: { [key: string]: string } = {}; + private headers: Headers = {}; private body: RequestBody = undefined; private url: URL; @@ -93,7 +95,7 @@ export class RequestContext { return this.httpMethod; } - public getHeaders(): { [key: string]: string } { + public getHeaders(): Headers { return this.headers; } @@ -160,7 +162,7 @@ export class SelfDecodingBody implements ResponseBody { export class ResponseContext { public constructor( public httpStatusCode: number, - public headers: { [key: string]: string }, + public headers: Headers, public body: ResponseBody ) {} @@ -171,8 +173,8 @@ export class ResponseContext { * Parameter names are converted to lower case * The first parameter is returned with the key `""` */ - public getParsedHeader(headerName: string): { [parameter: string]: string } { - const result: { [parameter: string]: string } = {}; + public getParsedHeader(headerName: string): Headers { + const result: Headers = {}; if (!this.headers[headerName]) { return result; } @@ -245,7 +247,7 @@ export function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLib export class HttpInfo extends ResponseContext { public constructor( public httpStatusCode: number, - public headers: { [key: string]: string }, + public headers: Headers, public body: ResponseBody, public data: T, ) {