diff --git a/modules/openapi-generator/src/main/resources/typescript/http/http.mustache b/modules/openapi-generator/src/main/resources/typescript/http/http.mustache index 2f71d86109f2..72bb0e927ba9 100644 --- a/modules/openapi-generator/src/main/resources/typescript/http/http.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/http/http.mustache @@ -57,6 +57,8 @@ export type HttpFile = {{{fileContentDataType}}} & { readonly name: string }; {{/node}} {{/platforms}} +export type Headers = { [key: string]: string } + {{#platforms}} {{#deno}} /** @@ -110,7 +112,7 @@ export type RequestBody = undefined | string | FormData | URLSearchParams; * Represents an HTTP request context */ export class RequestContext { - private headers: { [key: string]: string } = {}; + private headers: Headers = {}; private body: RequestBody = undefined; private url: URLParse; @@ -120,8 +122,9 @@ export class RequestContext { * @param url url of the requested resource * @param httpMethod http method */ - public constructor(url: string, private httpMethod: HttpMethod) { + public constructor(url: string, private httpMethod: HttpMethod, headers: Headers = {}) { this.url = new URLParse(url, true); + this.headers = headers; } /* @@ -157,7 +160,7 @@ export class RequestContext { return this.httpMethod; } - public getHeaders(): { [key: string]: string } { + public getHeaders(): Headers { return this.headers; } diff --git a/modules/openapi-generator/src/main/resources/typescript/http/servers.mustache b/modules/openapi-generator/src/main/resources/typescript/http/servers.mustache index d2a0a254255c..7b4892c8b40d 100644 --- a/modules/openapi-generator/src/main/resources/typescript/http/servers.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/http/servers.mustache @@ -1,7 +1,10 @@ -import { RequestContext, HttpMethod } from "./http/http{{extensionForDeno}}"; +import { RequestContext, HttpMethod, Headers } from "./http/http{{extensionForDeno}}"; export interface BaseServerConfiguration { + getHeaders(): Headers makeRequestContext(endpoint: string, httpMethod: HttpMethod): RequestContext; + addHeaders(headers: Headers): any; + setHeaderParam(key: string, value: string): void } /** @@ -11,7 +14,7 @@ export interface BaseServerConfiguration { * */ export class ServerConfiguration implements BaseServerConfiguration { - public constructor(private url: string, private variableConfiguration: T) {} + public constructor(private url: string, private variableConfiguration: T, private headers: Headers = {}) {} /** * Sets the value of the variables of this server. @@ -26,6 +29,18 @@ export class ServerConfiguration implements return this.variableConfiguration } + public addHeaders(headers: Headers): void { + Object.assign(this.headers, headers); + } + + public getHeaders(): Headers { + return this.headers + } + + public setHeaderParam(key: string, value: string): void { + this.headers[key] = value; + } + private getUrl() { let replacedUrl = this.url; for (const key in this.variableConfiguration) { @@ -44,7 +59,7 @@ export class ServerConfiguration implements * */ public makeRequestContext(endpoint: string, httpMethod: HttpMethod): RequestContext { - return new RequestContext(this.getUrl() + endpoint, httpMethod); + return new RequestContext(this.getUrl() + endpoint, httpMethod, Object.assign({}, this.headers)); } } diff --git a/modules/openapi-generator/src/main/resources/typescript/services/http.mustache b/modules/openapi-generator/src/main/resources/typescript/services/http.mustache index f234886dfd84..66685f4196de 100644 --- a/modules/openapi-generator/src/main/resources/typescript/services/http.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/services/http.mustache @@ -1,7 +1,7 @@ {{#useRxJS}} import type { Observable } from "rxjs"; {{/useRxJS}} -import type { {{^useRxJS}}Promise{{/useRxJS}}HttpLibrary, HttpMethod, RequestContext, ResponseContext } from "../http/http"; +import type { {{^useRxJS}}Promise{{/useRxJS}}HttpLibrary, Headers, HttpMethod, RequestContext, ResponseContext } from "../http/http"; import type { {{^useRxJS}}Promise{{/useRxJS}}Middleware } from "../middleware"; import type { BaseServerConfiguration } from "../servers"; @@ -15,5 +15,8 @@ export abstract class AbstractMiddleware implements {{^useRxJS}}Promise{{/useRxJ } export abstract class AbstractServerConfiguration implements BaseServerConfiguration { + public abstract getHeaders(): Headers public abstract makeRequestContext(endpoint: string, httpMethod: HttpMethod): RequestContext; + public abstract addHeaders(headers: Headers): any; + public abstract setHeaderParam(key: string, value: string): void }; diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts index f19e206b19ff..2e20897c5414 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts @@ -25,6 +25,8 @@ export enum HttpMethod { */ export type HttpFile = Blob & { readonly name: string }; +export type Headers = { [key: string]: string } + export class HttpException extends Error { public constructor(msg: string) { @@ -41,7 +43,7 @@ export type RequestBody = undefined | string | FormData | URLSearchParams; * Represents an HTTP request context */ export class RequestContext { - private headers: { [key: string]: string } = {}; + private headers: Headers = {}; private body: RequestBody = undefined; private url: URLParse; @@ -51,8 +53,9 @@ export class RequestContext { * @param url url of the requested resource * @param httpMethod http method */ - public constructor(url: string, private httpMethod: HttpMethod) { + public constructor(url: string, private httpMethod: HttpMethod, headers: Headers = {}) { this.url = new URLParse(url, true); + this.headers = headers; } /* @@ -88,7 +91,7 @@ export class RequestContext { return this.httpMethod; } - public getHeaders(): { [key: string]: string } { + public getHeaders(): Headers { return this.headers; } diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/servers.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/servers.ts index f1bd953bf872..89599310c157 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/servers.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/servers.ts @@ -1,7 +1,10 @@ -import { RequestContext, HttpMethod } from "./http/http"; +import { RequestContext, HttpMethod, Headers } from "./http/http"; export interface BaseServerConfiguration { + getHeaders(): Headers makeRequestContext(endpoint: string, httpMethod: HttpMethod): RequestContext; + addHeaders(headers: Headers): any; + setHeaderParam(key: string, value: string): void } /** @@ -11,7 +14,7 @@ export interface BaseServerConfiguration { * */ export class ServerConfiguration implements BaseServerConfiguration { - public constructor(private url: string, private variableConfiguration: T) {} + public constructor(private url: string, private variableConfiguration: T, private headers: Headers = {}) {} /** * Sets the value of the variables of this server. @@ -26,6 +29,18 @@ export class ServerConfiguration implements return this.variableConfiguration } + public addHeaders(headers: Headers): void { + Object.assign(this.headers, headers); + } + + public getHeaders(): Headers { + return this.headers + } + + public setHeaderParam(key: string, value: string): void { + this.headers[key] = value; + } + private getUrl() { let replacedUrl = this.url; for (const key in this.variableConfiguration) { @@ -44,7 +59,7 @@ export class ServerConfiguration implements * */ public makeRequestContext(endpoint: string, httpMethod: HttpMethod): RequestContext { - return new RequestContext(this.getUrl() + endpoint, httpMethod); + return new RequestContext(this.getUrl() + endpoint, httpMethod, Object.assign({}, this.headers)); } } diff --git a/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts index a623aef12789..0be0f7d9748d 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts @@ -31,6 +31,8 @@ export type HttpFile = { name: string }; +export type Headers = { [key: string]: string } + export class HttpException extends Error { public constructor(msg: string) { @@ -47,7 +49,7 @@ export type RequestBody = undefined | string | FormData | URLSearchParams; * Represents an HTTP request context */ export class RequestContext { - private headers: { [key: string]: string } = {}; + private headers: Headers = {}; private body: RequestBody = undefined; private url: URLParse; @@ -57,8 +59,9 @@ export class RequestContext { * @param url url of the requested resource * @param httpMethod http method */ - public constructor(url: string, private httpMethod: HttpMethod) { + public constructor(url: string, private httpMethod: HttpMethod, headers: Headers = {}) { this.url = new URLParse(url, true); + this.headers = headers; } /* @@ -94,7 +97,7 @@ export class RequestContext { return this.httpMethod; } - public getHeaders(): { [key: string]: string } { + public getHeaders(): Headers { return this.headers; } diff --git a/samples/openapi3/client/petstore/typescript/builds/default/servers.ts b/samples/openapi3/client/petstore/typescript/builds/default/servers.ts index ce34c8714c0c..429413412cb2 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/servers.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/servers.ts @@ -1,7 +1,10 @@ -import { RequestContext, HttpMethod } from "./http/http"; +import { RequestContext, HttpMethod, Headers } from "./http/http"; export interface BaseServerConfiguration { + getHeaders(): Headers makeRequestContext(endpoint: string, httpMethod: HttpMethod): RequestContext; + addHeaders(headers: Headers): any; + setHeaderParam(key: string, value: string): void } /** @@ -11,7 +14,7 @@ export interface BaseServerConfiguration { * */ export class ServerConfiguration implements BaseServerConfiguration { - public constructor(private url: string, private variableConfiguration: T) {} + public constructor(private url: string, private variableConfiguration: T, private headers: Headers = {}) {} /** * Sets the value of the variables of this server. @@ -26,6 +29,18 @@ export class ServerConfiguration implements return this.variableConfiguration } + public addHeaders(headers: Headers): void { + Object.assign(this.headers, headers); + } + + public getHeaders(): Headers { + return this.headers + } + + public setHeaderParam(key: string, value: string): void { + this.headers[key] = value; + } + private getUrl() { let replacedUrl = this.url; for (const key in this.variableConfiguration) { @@ -44,7 +59,7 @@ export class ServerConfiguration implements * */ public makeRequestContext(endpoint: string, httpMethod: HttpMethod): RequestContext { - return new RequestContext(this.getUrl() + endpoint, httpMethod); + return new RequestContext(this.getUrl() + endpoint, httpMethod, Object.assign({}, this.headers)); } } diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts index 139149cec973..cb14868771e2 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts @@ -21,6 +21,8 @@ export enum HttpMethod { */ export type HttpFile = Blob & { readonly name: string }; +export type Headers = { [key: string]: string } + /** * URLParse Wrapper for Deno */ @@ -70,7 +72,7 @@ export type RequestBody = undefined | string | FormData | URLSearchParams; * Represents an HTTP request context */ export class RequestContext { - private headers: { [key: string]: string } = {}; + private headers: Headers = {}; private body: RequestBody = undefined; private url: URLParse; @@ -80,8 +82,9 @@ export class RequestContext { * @param url url of the requested resource * @param httpMethod http method */ - public constructor(url: string, private httpMethod: HttpMethod) { + public constructor(url: string, private httpMethod: HttpMethod, headers: Headers = {}) { this.url = new URLParse(url, true); + this.headers = headers; } /* @@ -117,7 +120,7 @@ export class RequestContext { return this.httpMethod; } - public getHeaders(): { [key: string]: string } { + public getHeaders(): Headers { return this.headers; } diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/servers.ts b/samples/openapi3/client/petstore/typescript/builds/deno/servers.ts index 6e5f2cc8cfdd..40bd399617d4 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/servers.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/servers.ts @@ -1,7 +1,10 @@ -import { RequestContext, HttpMethod } from "./http/http.ts"; +import { RequestContext, HttpMethod, Headers } from "./http/http.ts"; export interface BaseServerConfiguration { + getHeaders(): Headers makeRequestContext(endpoint: string, httpMethod: HttpMethod): RequestContext; + addHeaders(headers: Headers): any; + setHeaderParam(key: string, value: string): void } /** @@ -11,7 +14,7 @@ export interface BaseServerConfiguration { * */ export class ServerConfiguration implements BaseServerConfiguration { - public constructor(private url: string, private variableConfiguration: T) {} + public constructor(private url: string, private variableConfiguration: T, private headers: Headers = {}) {} /** * Sets the value of the variables of this server. @@ -26,6 +29,18 @@ export class ServerConfiguration implements return this.variableConfiguration } + public addHeaders(headers: Headers): void { + Object.assign(this.headers, headers); + } + + public getHeaders(): Headers { + return this.headers + } + + public setHeaderParam(key: string, value: string): void { + this.headers[key] = value; + } + private getUrl() { let replacedUrl = this.url; for (const key in this.variableConfiguration) { @@ -44,7 +59,7 @@ export class ServerConfiguration implements * */ public makeRequestContext(endpoint: string, httpMethod: HttpMethod): RequestContext { - return new RequestContext(this.getUrl() + endpoint, httpMethod); + return new RequestContext(this.getUrl() + endpoint, httpMethod, Object.assign({}, this.headers)); } } diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts index a623aef12789..0be0f7d9748d 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts @@ -31,6 +31,8 @@ export type HttpFile = { name: string }; +export type Headers = { [key: string]: string } + export class HttpException extends Error { public constructor(msg: string) { @@ -47,7 +49,7 @@ export type RequestBody = undefined | string | FormData | URLSearchParams; * Represents an HTTP request context */ export class RequestContext { - private headers: { [key: string]: string } = {}; + private headers: Headers = {}; private body: RequestBody = undefined; private url: URLParse; @@ -57,8 +59,9 @@ export class RequestContext { * @param url url of the requested resource * @param httpMethod http method */ - public constructor(url: string, private httpMethod: HttpMethod) { + public constructor(url: string, private httpMethod: HttpMethod, headers: Headers = {}) { this.url = new URLParse(url, true); + this.headers = headers; } /* @@ -94,7 +97,7 @@ export class RequestContext { return this.httpMethod; } - public getHeaders(): { [key: string]: string } { + public getHeaders(): Headers { return this.headers; } diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/servers.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/servers.ts index ce34c8714c0c..429413412cb2 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/servers.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/servers.ts @@ -1,7 +1,10 @@ -import { RequestContext, HttpMethod } from "./http/http"; +import { RequestContext, HttpMethod, Headers } from "./http/http"; export interface BaseServerConfiguration { + getHeaders(): Headers makeRequestContext(endpoint: string, httpMethod: HttpMethod): RequestContext; + addHeaders(headers: Headers): any; + setHeaderParam(key: string, value: string): void } /** @@ -11,7 +14,7 @@ export interface BaseServerConfiguration { * */ export class ServerConfiguration implements BaseServerConfiguration { - public constructor(private url: string, private variableConfiguration: T) {} + public constructor(private url: string, private variableConfiguration: T, private headers: Headers = {}) {} /** * Sets the value of the variables of this server. @@ -26,6 +29,18 @@ export class ServerConfiguration implements return this.variableConfiguration } + public addHeaders(headers: Headers): void { + Object.assign(this.headers, headers); + } + + public getHeaders(): Headers { + return this.headers + } + + public setHeaderParam(key: string, value: string): void { + this.headers[key] = value; + } + private getUrl() { let replacedUrl = this.url; for (const key in this.variableConfiguration) { @@ -44,7 +59,7 @@ export class ServerConfiguration implements * */ public makeRequestContext(endpoint: string, httpMethod: HttpMethod): RequestContext { - return new RequestContext(this.getUrl() + endpoint, httpMethod); + return new RequestContext(this.getUrl() + endpoint, httpMethod, Object.assign({}, this.headers)); } } diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/services/http.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/services/http.ts index 18c3713ace0b..33c91ba01ca9 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/services/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/services/http.ts @@ -1,4 +1,4 @@ -import type { PromiseHttpLibrary, HttpMethod, RequestContext, ResponseContext } from "../http/http"; +import type { PromiseHttpLibrary, Headers, HttpMethod, RequestContext, ResponseContext } from "../http/http"; import type { PromiseMiddleware } from "../middleware"; import type { BaseServerConfiguration } from "../servers"; @@ -12,5 +12,8 @@ export abstract class AbstractMiddleware implements PromiseMiddleware { } export abstract class AbstractServerConfiguration implements BaseServerConfiguration { + public abstract getHeaders(): Headers public abstract makeRequestContext(endpoint: string, httpMethod: HttpMethod): RequestContext; + public abstract addHeaders(headers: Headers): any; + public abstract setHeaderParam(key: string, value: string): void }; diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts index 4b9ef54beeb5..2dad68e9903e 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts @@ -25,6 +25,8 @@ export enum HttpMethod { */ export type HttpFile = Blob & { readonly name: string }; +export type Headers = { [key: string]: string } + export class HttpException extends Error { public constructor(msg: string) { @@ -41,7 +43,7 @@ export type RequestBody = undefined | string | FormData | URLSearchParams; * Represents an HTTP request context */ export class RequestContext { - private headers: { [key: string]: string } = {}; + private headers: Headers = {}; private body: RequestBody = undefined; private url: URLParse; @@ -51,8 +53,9 @@ export class RequestContext { * @param url url of the requested resource * @param httpMethod http method */ - public constructor(url: string, private httpMethod: HttpMethod) { + public constructor(url: string, private httpMethod: HttpMethod, headers: Headers = {}) { this.url = new URLParse(url, true); + this.headers = headers; } /* @@ -88,7 +91,7 @@ export class RequestContext { return this.httpMethod; } - public getHeaders(): { [key: string]: string } { + public getHeaders(): Headers { return this.headers; } diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/servers.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/servers.ts index ce34c8714c0c..429413412cb2 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/servers.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/servers.ts @@ -1,7 +1,10 @@ -import { RequestContext, HttpMethod } from "./http/http"; +import { RequestContext, HttpMethod, Headers } from "./http/http"; export interface BaseServerConfiguration { + getHeaders(): Headers makeRequestContext(endpoint: string, httpMethod: HttpMethod): RequestContext; + addHeaders(headers: Headers): any; + setHeaderParam(key: string, value: string): void } /** @@ -11,7 +14,7 @@ export interface BaseServerConfiguration { * */ export class ServerConfiguration implements BaseServerConfiguration { - public constructor(private url: string, private variableConfiguration: T) {} + public constructor(private url: string, private variableConfiguration: T, private headers: Headers = {}) {} /** * Sets the value of the variables of this server. @@ -26,6 +29,18 @@ export class ServerConfiguration implements return this.variableConfiguration } + public addHeaders(headers: Headers): void { + Object.assign(this.headers, headers); + } + + public getHeaders(): Headers { + return this.headers + } + + public setHeaderParam(key: string, value: string): void { + this.headers[key] = value; + } + private getUrl() { let replacedUrl = this.url; for (const key in this.variableConfiguration) { @@ -44,7 +59,7 @@ export class ServerConfiguration implements * */ public makeRequestContext(endpoint: string, httpMethod: HttpMethod): RequestContext { - return new RequestContext(this.getUrl() + endpoint, httpMethod); + return new RequestContext(this.getUrl() + endpoint, httpMethod, Object.assign({}, this.headers)); } } diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts index a623aef12789..0be0f7d9748d 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts @@ -31,6 +31,8 @@ export type HttpFile = { name: string }; +export type Headers = { [key: string]: string } + export class HttpException extends Error { public constructor(msg: string) { @@ -47,7 +49,7 @@ export type RequestBody = undefined | string | FormData | URLSearchParams; * Represents an HTTP request context */ export class RequestContext { - private headers: { [key: string]: string } = {}; + private headers: Headers = {}; private body: RequestBody = undefined; private url: URLParse; @@ -57,8 +59,9 @@ export class RequestContext { * @param url url of the requested resource * @param httpMethod http method */ - public constructor(url: string, private httpMethod: HttpMethod) { + public constructor(url: string, private httpMethod: HttpMethod, headers: Headers = {}) { this.url = new URLParse(url, true); + this.headers = headers; } /* @@ -94,7 +97,7 @@ export class RequestContext { return this.httpMethod; } - public getHeaders(): { [key: string]: string } { + public getHeaders(): Headers { return this.headers; } diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/servers.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/servers.ts index ce34c8714c0c..429413412cb2 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/servers.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/servers.ts @@ -1,7 +1,10 @@ -import { RequestContext, HttpMethod } from "./http/http"; +import { RequestContext, HttpMethod, Headers } from "./http/http"; export interface BaseServerConfiguration { + getHeaders(): Headers makeRequestContext(endpoint: string, httpMethod: HttpMethod): RequestContext; + addHeaders(headers: Headers): any; + setHeaderParam(key: string, value: string): void } /** @@ -11,7 +14,7 @@ export interface BaseServerConfiguration { * */ export class ServerConfiguration implements BaseServerConfiguration { - public constructor(private url: string, private variableConfiguration: T) {} + public constructor(private url: string, private variableConfiguration: T, private headers: Headers = {}) {} /** * Sets the value of the variables of this server. @@ -26,6 +29,18 @@ export class ServerConfiguration implements return this.variableConfiguration } + public addHeaders(headers: Headers): void { + Object.assign(this.headers, headers); + } + + public getHeaders(): Headers { + return this.headers + } + + public setHeaderParam(key: string, value: string): void { + this.headers[key] = value; + } + private getUrl() { let replacedUrl = this.url; for (const key in this.variableConfiguration) { @@ -44,7 +59,7 @@ export class ServerConfiguration implements * */ public makeRequestContext(endpoint: string, httpMethod: HttpMethod): RequestContext { - return new RequestContext(this.getUrl() + endpoint, httpMethod); + return new RequestContext(this.getUrl() + endpoint, httpMethod, Object.assign({}, this.headers)); } }