Skip to content

Commit 01987d0

Browse files
authored
chore: remove deprecated micro-api-client (#6447)
1 parent 3f73828 commit 01987d0

File tree

4 files changed

+28
-11
lines changed

4 files changed

+28
-11
lines changed

package-lock.json

Lines changed: 0 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/js-client/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
"dependencies": {
4444
"@netlify/open-api": "^2.37.0",
4545
"lodash-es": "^4.17.21",
46-
"micro-api-client": "^3.3.0",
4746
"node-fetch": "^3.0.0",
4847
"p-wait-for": "^5.0.0",
4948
"qs": "^6.9.6"

packages/js-client/src/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import http from 'http'
22

33
import test from 'ava'
44
import fromString from 'from2-string'
5-
import { TextHTTPError, JSONHTTPError } from 'micro-api-client'
65
import nock from 'nock'
76
import { v4 as uuidv4 } from 'uuid'
87

98
import { NetlifyAPI } from '../lib/index.js'
9+
import { TextHTTPError, JSONHTTPError } from '../lib/methods/response.js'
1010

1111
const scheme = 'http'
1212
const domain = 'localhost'

packages/js-client/src/methods/response.js

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,32 @@
1-
import { JSONHTTPError, TextHTTPError } from 'micro-api-client'
2-
31
import omit from '../omit.js'
42

3+
export class HTTPError extends Error {
4+
constructor(response) {
5+
super(response.statusText)
6+
this.name = this.constructor.name
7+
if (typeof Error.captureStackTrace === 'function') {
8+
Error.captureStackTrace(this, this.constructor)
9+
} else {
10+
this.stack = new Error(response.statusText).stack
11+
}
12+
this.status = response.status
13+
}
14+
}
15+
16+
export class TextHTTPError extends HTTPError {
17+
constructor(response, data) {
18+
super(response)
19+
this.data = data
20+
}
21+
}
22+
23+
export class JSONHTTPError extends HTTPError {
24+
constructor(response, json) {
25+
super(response)
26+
this.json = json
27+
}
28+
}
29+
530
// Read and parse the HTTP response
631
export const parseResponse = async function (response) {
732
const responseType = getResponseType(response)

0 commit comments

Comments
 (0)