Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump axios major version #1083

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 25 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"@sendgrid/mail": "^7.4.2",
"@types/chai-spies": "^1.0.3",
"ajv": "^8.11.0",
"axios": "^0.27.2",
"axios": "^1.4.0",
"boxen": "^5.0.0",
"bree": "^9.1.3",
"chalk": "^4.1.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/notification/channel/__test__/pagerduty.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ describe('PagerDuty notification', () => {
)

// act
server.listen()
server.listen({ onUnhandledRequest: 'bypass' })
await send(
[{ key: routingKey, probeID: '65DDKmmB9mSaeE-8bMXRN' }],
message
Expand Down Expand Up @@ -178,7 +178,7 @@ describe('PagerDuty notification', () => {
)

// act
server.listen()
server.listen({ onUnhandledRequest: 'bypass' })
await send(
[{ key: routingKey, probeID: '65DDKmmB9mSaeE-8bMXRN' }],
message
Expand Down
2 changes: 1 addition & 1 deletion packages/notification/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@types/chai": "^4.2.15",
"@types/chai-as-promised": "^7.1.5",
"@types/chai-spies": "^1.0.3",
"axios": "^0.27.2",
"axios": "^1.4.0",
"chai": "^4.3.4",
"chai-as-promised": "^7.1.1",
"chai-spies": "^1.0.0",
Expand Down
6 changes: 3 additions & 3 deletions src/components/config/parse-insomnia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import yml from 'js-yaml'
import { Probe } from '../../interfaces/probe'
import { DEFAULT_THRESHOLD } from '../../looper'
import { compile } from 'handlebars'
import { AxiosRequestHeaders, Method } from 'axios'
import { Method, RawAxiosRequestHeaders } from 'axios'

interface InsomniaResource {
_id: string
Expand Down Expand Up @@ -106,10 +106,10 @@ function mapInsomniaRequestToConfig(res: InsomniaResource): Probe {
// eslint-disable-next-line camelcase
const url = compile(res.url)({ base_url: baseUrl })
const authorization = getAuthorizationHeader(res)
let headers: AxiosRequestHeaders | undefined
let headers: RawAxiosRequestHeaders | undefined
if (authorization)
headers = {
authorization,
Authorization: authorization,
}
if (res.headers) {
if (headers === undefined) headers = {}
Expand Down
2 changes: 1 addition & 1 deletion src/components/probe/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const probes: Probe[] = [
},
]

beforeEach(() => server.listen())
beforeEach(() => server.listen({ onUnhandledRequest: 'bypass' }))
afterEach(() => {
urlRequestTotal = 0
server.close()
Expand Down
10 changes: 5 additions & 5 deletions src/components/probe/prober/http/request.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ describe('probingHTTP', () => {
const flags = { followRedirects: 0 } as unknown as MonikaFlags
setContext({ flags })
// act
server.listen()
server.listen({ onUnhandledRequest: 'bypass' })
const res = await httpRequest({
requestConfig: request,
responses: [],
Expand Down Expand Up @@ -218,7 +218,7 @@ describe('probingHTTP', () => {
}

// act
server.listen()
server.listen({ onUnhandledRequest: 'bypass' })
const flag = { followRedirects: 0 } as unknown as MonikaFlags
setContext({ flags: flag })
const res = await httpRequest({
Expand Down Expand Up @@ -259,7 +259,7 @@ describe('probingHTTP', () => {
}

// act
server.listen()
server.listen({ onUnhandledRequest: 'bypass' })
const flag = { followRedirects: 0 } as unknown as MonikaFlags
setContext({ flags: flag })
const res = await httpRequest({
Expand Down Expand Up @@ -301,7 +301,7 @@ describe('probingHTTP', () => {
}

// act
server.listen()
server.listen({ onUnhandledRequest: 'bypass' })
const flag = { followRedirects: 0 } as unknown as MonikaFlags
setContext({ flags: flag })
const res = await httpRequest({
Expand Down Expand Up @@ -343,7 +343,7 @@ describe('probingHTTP', () => {
}

// act
server.listen()
server.listen({ onUnhandledRequest: 'bypass' })
const flag = { followRedirects: 0 } as unknown as MonikaFlags
setContext({ flags: flag })
const res = await httpRequest({
Expand Down
6 changes: 2 additions & 4 deletions src/components/probe/prober/http/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { getContext } from '../../../../context'
import { icmpRequest } from '../icmp/request'
import registerFakes from '../../../../utils/fakes'
import { sendHttpRequest } from '../../../../utils/http'
import { AxiosHeaderValue } from 'axios'

// Register Handlebars helpers
registerFakes(Handlebars)
Expand Down Expand Up @@ -227,10 +228,7 @@ export function generateRequestChainingBody(
return isString ? renderedBody : JSON.parse(renderedBody)
}

function transformContentByType(
content: any,
contentType?: string | number | boolean
) {
function transformContentByType(content: any, contentType?: AxiosHeaderValue) {
switch (contentType) {
case 'application/x-www-form-urlencoded':
return {
Expand Down
4 changes: 2 additions & 2 deletions src/interfaces/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* SOFTWARE. *
**********************************************************************************/

import { AxiosRequestConfig, AxiosRequestHeaders } from 'axios'
import { AxiosRequestConfig, RawAxiosRequestHeaders } from 'axios'
import { ProbeAlert } from './probe'

// RequestTypes are used to define the type of request that is being made.
Expand Down Expand Up @@ -59,7 +59,7 @@ export interface RequestConfig extends Omit<AxiosRequestConfig, 'data'> {
body: JSON | string
timeout: number // request timeout
alerts?: ProbeAlert[]
headers?: AxiosRequestHeaders
headers?: RawAxiosRequestHeaders
ping?: boolean // is this request for a ping?
allowUnauthorized?: boolean // ignore ssl cert?
}
6 changes: 3 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"composite": true,
"declaration": true,
"importHelpers": true,
"module": "commonjs",
"module": "CommonJS",
"outDir": "lib",
"rootDir": "src",
"lib": ["ES2021.String", "DOM"],
"lib": ["ES2015", "DOM"],
"strict": true,
"target": "es2017",
"target": "ES2015",
"skipLibCheck": true,
"esModuleInterop": true,
"resolveJsonModule": true,
Expand Down
Loading