Skip to content

Commit 30bc235

Browse files
authored
Merge pull request ferdikoomen#1442 from edwinveldhuizen/feature/extendable-custom-request
[request] export used functions for reusability
2 parents 78354d5 + 4f00cd3 commit 30bc235

32 files changed

+32
-32
lines changed

src/templates/core/angular/getHeaders.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const getHeaders = (config: OpenAPIConfig, options: ApiRequestOptions): Observable<HttpHeaders> => {
1+
export const getHeaders = (config: OpenAPIConfig, options: ApiRequestOptions): Observable<HttpHeaders> => {
22
return forkJoin({
33
token: resolve(options, config.TOKEN),
44
username: resolve(options, config.USERNAME),

src/templates/core/angular/getRequestBody.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const getRequestBody = (options: ApiRequestOptions): any => {
1+
export const getRequestBody = (options: ApiRequestOptions): any => {
22
if (options.body) {
33
if (options.mediaType?.includes('/json')) {
44
return JSON.stringify(options.body)

src/templates/core/angular/getResponseBody.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const getResponseBody = <T>(response: HttpResponse<T>): T | undefined => {
1+
export const getResponseBody = <T>(response: HttpResponse<T>): T | undefined => {
22
if (response.status !== 204 && response.body !== null) {
33
return response.body;
44
}

src/templates/core/angular/getResponseHeader.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const getResponseHeader = <T>(response: HttpResponse<T>, responseHeader?: string): string | undefined => {
1+
export const getResponseHeader = <T>(response: HttpResponse<T>, responseHeader?: string): string | undefined => {
22
if (responseHeader) {
33
const value = response.headers.get(responseHeader);
44
if (isString(value)) {

src/templates/core/axios/getHeaders.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions, formData?: FormData): Promise<Record<string, string>> => {
1+
export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions, formData?: FormData): Promise<Record<string, string>> => {
22
const token = await resolve(options, config.TOKEN);
33
const username = await resolve(options, config.USERNAME);
44
const password = await resolve(options, config.PASSWORD);

src/templates/core/axios/getRequestBody.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const getRequestBody = (options: ApiRequestOptions): any => {
1+
export const getRequestBody = (options: ApiRequestOptions): any => {
22
if (options.body) {
33
return options.body;
44
}

src/templates/core/axios/getResponseBody.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const getResponseBody = (response: AxiosResponse<any>): any => {
1+
export const getResponseBody = (response: AxiosResponse<any>): any => {
22
if (response.status !== 204) {
33
return response.data;
44
}

src/templates/core/axios/getResponseHeader.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const getResponseHeader = (response: AxiosResponse<any>, responseHeader?: string): string | undefined => {
1+
export const getResponseHeader = (response: AxiosResponse<any>, responseHeader?: string): string | undefined => {
22
if (responseHeader) {
33
const content = response.headers[responseHeader];
44
if (isString(content)) {

src/templates/core/axios/sendRequest.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const sendRequest = async <T>(
1+
export const sendRequest = async <T>(
22
config: OpenAPIConfig,
33
options: ApiRequestOptions,
44
url: string,

src/templates/core/fetch/getHeaders.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions): Promise<Headers> => {
1+
export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions): Promise<Headers> => {
22
const token = await resolve(options, config.TOKEN);
33
const username = await resolve(options, config.USERNAME);
44
const password = await resolve(options, config.PASSWORD);

0 commit comments

Comments
 (0)