Skip to content

feature: added custom axios request #1438

feature: added custom axios request

feature: added custom axios request #1438

Triggered via pull request November 13, 2024 13:53
Status Failure
Total duration 1m 10s
Artifacts

main.yml

on: pull_request
build-and-test
59s
build-and-test
Fit to window
Zoom out
Zoom in

Annotations

4 errors
tests/spec/axios/basic.test.ts > basic > --axios option: tests/spec/axios/basic.test.ts#L34
Error: Snapshot `basic > --axios option 1` mismatched - Expected + Received @@ -9,288 +9,170 @@ * --------------------------------------------------------------- */ /** A user or organization */ export interface Actor { - avatar_url?: string; - bio?: string; - /** The website URL from the profile page */ - blog?: string; - collaborators?: number; - company?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - disk_usage?: number; - /** Note: The returned email is the user’s publicly visible email address (or null if the user has not specified a public email address in their profile). */ - email?: string; - followers?: number; - followers_url?: string; - following?: number; - following_url?: string; - gists_url?: string; - gravatar_id?: string; - hireable?: boolean; - html_url?: string; - id?: number; - location?: string; - /** The account username */ - login?: string; - /** The full account name */ - name?: string; - organizations_url?: string; - owned_private_repos?: number; - plan?: { + avatar_url?: string; + bio?: string; + /** The website URL from the profile page */ + blog?: string; collaborators?: number; + company?: string; + /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ + created_at?: string; + disk_usage?: number; + /** Note: The returned email is the user’s publicly visible email address (or null if the user has not specified a public email address in their profile). */ + email?: string; + followers?: number; + followers_url?: string; + following?: number; + following_url?: string; + gists_url?: string; + gravatar_id?: string; + hireable?: boolean; + html_url?: string; + id?: number; + location?: string; + /** The account username */ + login?: string; + /** The full account name */ name?: string; - private_repos?: number; - space?: number; - }; - private_gists?: number; - public_gists?: number; - public_repos?: number; - starred_url?: string; - subscriptions_url?: string; - total_private_repos?: number; - type?: "User" | "Organization"; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; + organizations_url?: string; + owned_private_repos?: number; + plan?: { + collaborators?: number; + name?: string; + private_repos?: number; + space?: number; + }; + private_gists?: number; + public_gists?: number; + public_repos?: number; + starred_url?: string; + subscriptions_url?: string; + total_private_repos?: number; + type?: "User" | "Organization"; + /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ + updated_at?: string; + url?: string; } export interface Asset { - content_type?: string; - created_at?: string; - download_count?: number; - id?: number; - label?: string; - name?: string; - size?: number; - state?: string; - updated_at?: string; - /** A GitHub user */ - uploader?: User; - url?: string; + content_type?: string; + created_at?: string; + download_count?: number; + id?: number; + label?: string; + name?: string; + size?: number; + state?: string; + updated_at?: string; + /** A GitHub user */ + uploader?: User; + url?: string; } export interface AssetPatch { - label?: string; - name: string; + label?: string; + name: string; } export type Assets = Asset[]; export type Assignees = User[]; export interface Blob { - content?: string; - encoding?: "utf-8" | "base64"; - sha?: string; - size?: number; + content?: string; + encoding?: "utf-8" | "base64"; + sha?: string; + size?: number; } export interface Blobs { - sha?: string; + sha?: string; } export interface Branch { - _links?: { - html?: string; - self?: string; - }; - commit?: { - /** A GitHub user */ - author?: User; + _links?: { + html?: string; + self?: string; + }; commit?: { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ -
tests/spec/axiosSingleHttpClient/basic.test.ts > basic > --axios --single-http-client: tests/spec/axiosSingleHttpClient/basic.test.ts#L35
Error: Snapshot `basic > --axios --single-http-client 1` mismatched - Expected + Received @@ -9,288 +9,170 @@ * --------------------------------------------------------------- */ /** A user or organization */ export interface Actor { - avatar_url?: string; - bio?: string; - /** The website URL from the profile page */ - blog?: string; - collaborators?: number; - company?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - disk_usage?: number; - /** Note: The returned email is the user’s publicly visible email address (or null if the user has not specified a public email address in their profile). */ - email?: string; - followers?: number; - followers_url?: string; - following?: number; - following_url?: string; - gists_url?: string; - gravatar_id?: string; - hireable?: boolean; - html_url?: string; - id?: number; - location?: string; - /** The account username */ - login?: string; - /** The full account name */ - name?: string; - organizations_url?: string; - owned_private_repos?: number; - plan?: { + avatar_url?: string; + bio?: string; + /** The website URL from the profile page */ + blog?: string; collaborators?: number; + company?: string; + /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ + created_at?: string; + disk_usage?: number; + /** Note: The returned email is the user’s publicly visible email address (or null if the user has not specified a public email address in their profile). */ + email?: string; + followers?: number; + followers_url?: string; + following?: number; + following_url?: string; + gists_url?: string; + gravatar_id?: string; + hireable?: boolean; + html_url?: string; + id?: number; + location?: string; + /** The account username */ + login?: string; + /** The full account name */ name?: string; - private_repos?: number; - space?: number; - }; - private_gists?: number; - public_gists?: number; - public_repos?: number; - starred_url?: string; - subscriptions_url?: string; - total_private_repos?: number; - type?: "User" | "Organization"; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; + organizations_url?: string; + owned_private_repos?: number; + plan?: { + collaborators?: number; + name?: string; + private_repos?: number; + space?: number; + }; + private_gists?: number; + public_gists?: number; + public_repos?: number; + starred_url?: string; + subscriptions_url?: string; + total_private_repos?: number; + type?: "User" | "Organization"; + /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ + updated_at?: string; + url?: string; } export interface Asset { - content_type?: string; - created_at?: string; - download_count?: number; - id?: number; - label?: string; - name?: string; - size?: number; - state?: string; - updated_at?: string; - /** A GitHub user */ - uploader?: User; - url?: string; + content_type?: string; + created_at?: string; + download_count?: number; + id?: number; + label?: string; + name?: string; + size?: number; + state?: string; + updated_at?: string; + /** A GitHub user */ + uploader?: User; + url?: string; } export interface AssetPatch { - label?: string; - name: string; + label?: string; + name: string; } export type Assets = Asset[]; export type Assignees = User[]; export interface Blob { - content?: string; - encoding?: "utf-8" | "base64"; - sha?: string; - size?: number; + content?: string; + encoding?: "utf-8" | "base64"; + sha?: string; + size?: number; } export interface Blobs { - sha?: string; + sha?: string; } export interface Branch { - _links?: { - html?: string; - self?: string; - }; - commit?: { - /** A GitHub user */ - author?: User; + _links?: { + html?: string; + self?: string; + }; commit?: { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDT
tests/spec/js/basic.test.ts > basic > --js --axios: tests/spec/js/basic.test.ts#L34
Error: Snapshot `basic > --js --axios 1` mismatched - Expected + Received @@ -21,15 +21,17 @@ instance; securityData = null; securityWorker; secure; format; - constructor({ securityWorker, secure, format, ...axiosConfig } = {}) { + customAction; + constructor({ securityWorker, secure, format, customAction, ...axiosConfig } = {}) { this.instance = axios.create({ ...axiosConfig, baseURL: axiosConfig.baseURL || "https://api.github.com" }); this.secure = secure; this.format = format; this.securityWorker = securityWorker; + this.customAction = customAction; } setSecurityData = (data) => { this.securityData = data; }; mergeRequestParams(params1, params2) { @@ -78,21 +80,23 @@ body = this.createFormData(body); } if (type === ContentType.Text && body && body !== null && typeof body !== "string") { body = JSON.stringify(body); } - return this.instance.request({ - ...requestParams, - headers: { - ...(requestParams.headers || {}), - ...(type ? { "Content-Type": type } : {}), - }, - params: query, - responseType: responseFormat, - data: body, - url: path, - }); + const action = () => + this.instance.request({ + ...requestParams, + headers: { + ...(requestParams.headers || {}), + ...(type ? { "Content-Type": type } : {}), + }, + params: query, + responseType: responseFormat, + data: body, + url: path, + }); + return this.customAction ? this.customAction(action) : action(); }; } /** * @title GitHub * @Version v3 ❯ tests/spec/js/basic.test.ts:34:21
build-and-test
Process completed with exit code 1.