balena-request
Advanced tools
Comparing version 11.5.10 to 12.0.0-build-klutchell-patch-1-59a1fccdc229e8bd82012e8220cddb4db642d9b0-1
@@ -55,3 +55,3 @@ /// <reference types="node" /> | ||
} | ||
export declare type BalenaRequest = ReturnType<typeof getRequest>; | ||
export type BalenaRequest = ReturnType<typeof getRequest>; | ||
/** | ||
@@ -58,0 +58,0 @@ * @module request |
@@ -7,4 +7,14 @@ # Change Log | ||
## 11.5.10 - 2022-11-01 | ||
## 12.0.0 - 2023-07-14 | ||
* Update TypeScript to 5.1.6 [Thodoris Greasidis] | ||
* Update mockttp to v3.8.0 [Thodoris Greasidis] | ||
* Drop support for node < 14 [Thodoris Greasidis] | ||
* Add querystring-es3 polyfill to fix browser tests [Thodoris Greasidis] | ||
* tsconfig: Enable skipLibCheck to avoid mockttp nested dependency errors [Thodoris Greasidis] | ||
* Update TypeScript to 4.9.5 [Thodoris Greasidis] | ||
* patch: Update flowzone.yml [Kyle Harding] | ||
## 11.5.10 - 2022-11-02 | ||
* Update balena-errors to v4.7.3 [JSReds] | ||
@@ -11,0 +21,0 @@ |
@@ -16,2 +16,3 @@ const getKarmaConfig = require('balena-config-karma'); | ||
path: false, | ||
querystring: require.resolve('querystring-es3'), | ||
stream: require.resolve('stream-browserify'), | ||
@@ -18,0 +19,0 @@ url: false, |
{ | ||
"name": "balena-request", | ||
"version": "11.5.10", | ||
"version": "12.0.0-build-klutchell-patch-1-59a1fccdc229e8bd82012e8220cddb4db642d9b0-1", | ||
"description": "Balena HTTP client", | ||
@@ -21,3 +21,3 @@ "main": "build/request.js", | ||
"engines": { | ||
"node": ">=10.0.0" | ||
"node": ">=14.0.0" | ||
}, | ||
@@ -58,4 +58,5 @@ "scripts": { | ||
"mocha": "^10.0.0", | ||
"mockttp": "^2.7.0", | ||
"mockttp": "^3.8.0", | ||
"process": "^0.11.10", | ||
"querystring-es3": "^0.2.1", | ||
"require-npm4-to-publish": "^1.0.0", | ||
@@ -67,3 +68,3 @@ "rindle": "^1.3.6", | ||
"timekeeper": "^1.0.0", | ||
"typescript": "^4.8.3", | ||
"typescript": "^5.1.6", | ||
"url": "^0.11.0", | ||
@@ -85,4 +86,4 @@ "util": "^0.12.4" | ||
"versionist": { | ||
"publishedAt": "2022-11-01T15:04:12.771Z" | ||
"publishedAt": "2023-07-14T08:17:32.667Z" | ||
} | ||
} |
@@ -29,3 +29,3 @@ const { expect } = require('chai'); | ||
describe('given a simple GET endpoint containing special characters in query strings', function () { | ||
beforeEach(() => mockServer.get(/^\/foo/).thenReply(200)); | ||
beforeEach(() => mockServer.forGet(/^\/foo/).thenReply(200)); | ||
@@ -62,3 +62,3 @@ describe('given no api key', () => | ||
describe('given a simple GET endpoint', function () { | ||
beforeEach(() => mockServer.get(/^\/foo/).thenReply(200, 'Foo Bar')); | ||
beforeEach(() => mockServer.forGet(/^\/foo/).thenReply(200, 'Foo Bar')); | ||
@@ -65,0 +65,0 @@ describe('given an api key', function () { |
@@ -23,7 +23,9 @@ const { expect } = require('chai'); | ||
Promise.all([ | ||
mockServer.get('/').thenJSON(200, { requested: '/' }), | ||
mockServer.forGet('/').thenJson(200, { requested: '/' }), | ||
mockServer | ||
.get('/original') | ||
.thenJSON(200, { requested: 'original' }), | ||
mockServer.get('/changed').thenJSON(200, { requested: 'changed' }), | ||
.forGet('/original') | ||
.thenJson(200, { requested: 'original' }), | ||
mockServer | ||
.forGet('/changed') | ||
.thenJson(200, { requested: 'changed' }), | ||
]), | ||
@@ -273,3 +275,3 @@ ), | ||
mockServer | ||
.get('/201') | ||
.forGet('/201') | ||
.thenReply(201) | ||
@@ -328,3 +330,3 @@ .then(function () { | ||
mockServer | ||
.get('/500') | ||
.forGet('/500') | ||
.thenReply(500) | ||
@@ -345,3 +347,3 @@ .then(function () { | ||
mockServer | ||
.get('/401') | ||
.forGet('/401') | ||
.thenReply(401) | ||
@@ -362,4 +364,4 @@ .then(function () { | ||
Promise.all([ | ||
mockServer.get('/ok').thenReply(200), | ||
mockServer.get('/fail').thenReply(500), | ||
mockServer.forGet('/ok').thenReply(200), | ||
mockServer.forGet('/fail').thenReply(500), | ||
]).then(function () { | ||
@@ -385,3 +387,3 @@ request.interceptors[0] = { | ||
mockServer | ||
.get('/500') | ||
.forGet('/500') | ||
.thenReply(500) | ||
@@ -410,3 +412,3 @@ .then(function () { | ||
mockServer | ||
.get('/no-response') | ||
.forGet('/no-response') | ||
.thenCloseConnection() | ||
@@ -435,3 +437,3 @@ .then(function () { | ||
mockServer | ||
.get('/500') | ||
.forGet('/500') | ||
.thenReply(500) | ||
@@ -438,0 +440,0 @@ .then(function () { |
@@ -25,3 +25,3 @@ const Bluebird = require('bluebird'); | ||
beforeEach(() => | ||
mockServer.get('/foo').thenJSON(200, { from: 'foobar' }), | ||
mockServer.forGet('/foo').thenJson(200, { from: 'foobar' }), | ||
); | ||
@@ -55,3 +55,5 @@ | ||
['get', 'post', 'put', 'patch', 'delete'].map((method) => | ||
mockServer[method]('/foo').thenJSON(200, { | ||
mockServer[`for${method[0].toUpperCase() + method.slice(1)}`]( | ||
'/foo', | ||
).thenJson(200, { | ||
method: method.toUpperCase(), | ||
@@ -76,3 +78,3 @@ }), | ||
beforeEach(() => | ||
mockServer.get('/non-json').thenReply(200, 'Hello World'), | ||
mockServer.forGet('/non-json').thenReply(200, 'Hello World'), | ||
); | ||
@@ -95,5 +97,5 @@ | ||
mockServer | ||
.post('/foo') | ||
.forPost('/foo') | ||
.withBody('Test body') | ||
.thenJSON(200, { matched: true }), | ||
.thenJson(200, { matched: true }), | ||
); | ||
@@ -119,3 +121,3 @@ | ||
beforeEach(() => | ||
mockServer.get('/hello').thenJSON(200, { hello: 'world' }), | ||
mockServer.forGet('/hello').thenJson(200, { hello: 'world' }), | ||
); | ||
@@ -138,4 +140,4 @@ | ||
mockServer | ||
.get('/500') | ||
.thenJSON(500, { error: { text: 'Server Error' } }), | ||
.forGet('/500') | ||
.thenJson(500, { error: { text: 'Server Error' } }), | ||
); | ||
@@ -167,3 +169,3 @@ | ||
describe('given no response error', function () { | ||
beforeEach(() => mockServer.head('/foo').thenReply(200)); | ||
beforeEach(() => mockServer.forHead('/foo').thenReply(200)); | ||
@@ -183,3 +185,3 @@ it('should correctly make the request', function () { | ||
describe('given a response error', function () { | ||
beforeEach(() => mockServer.head('/foo').thenReply(500)); | ||
beforeEach(() => mockServer.forHead('/foo').thenReply(500)); | ||
@@ -206,5 +208,5 @@ it('should be rejected with a generic error message', function () { | ||
beforeEach(() => | ||
mockServer[method]('/') | ||
mockServer[`for${method[0].toUpperCase() + method.slice(1)}`]('/') | ||
.withBody(JSON.stringify({ foo: 'bar' })) | ||
.thenJSON(200, { matched: true }), | ||
.thenJson(200, { matched: true }), | ||
); | ||
@@ -231,3 +233,3 @@ | ||
mockServer | ||
.get('/initially-failing') | ||
.forGet('/initially-failing') | ||
.twice() | ||
@@ -237,4 +239,4 @@ .thenCloseConnection() | ||
mockServer | ||
.get('/initially-failing') | ||
.thenJSON(200, { result: 'success' }), | ||
.forGet('/initially-failing') | ||
.thenJson(200, { result: 'success' }), | ||
), | ||
@@ -286,3 +288,3 @@ ); | ||
this.clock = sinon.useFakeTimers(); | ||
mockServer.get('/infinite-wait').thenTimeout(); | ||
mockServer.forGet('/infinite-wait').thenTimeout(); | ||
}); | ||
@@ -289,0 +291,0 @@ |
@@ -21,3 +21,3 @@ const Bluebird = require('bluebird'); | ||
beforeEach(() => | ||
mockServer.get('/').thenReply(200, JSON.stringify(RESPONSE_BODY), { | ||
mockServer.forGet('/').thenReply(200, JSON.stringify(RESPONSE_BODY), { | ||
'Content-Type': 'application/x-my-json', | ||
@@ -24,0 +24,0 @@ }), |
@@ -21,3 +21,3 @@ const Bluebird = require('bluebird'); | ||
beforeEach(() => | ||
mockServer.get('/foo').thenReply(400, 'Something happened'), | ||
mockServer.forGet('/foo').thenReply(400, 'Something happened'), | ||
); | ||
@@ -47,3 +47,3 @@ | ||
beforeEach(() => | ||
mockServer.get('/foo').thenReply(200, 'Lorem ipsum dolor sit amet'), | ||
mockServer.forGet('/foo').thenReply(200, 'Lorem ipsum dolor sit amet'), | ||
); | ||
@@ -84,3 +84,5 @@ | ||
['get', 'post', 'put', 'patch', 'delete'].forEach((method) => | ||
mockServer[method]('/foo').thenReply(200, method.toUpperCase()), | ||
mockServer[`for${method[0].toUpperCase() + method.slice(1)}`]( | ||
'/foo', | ||
).thenReply(200, method.toUpperCase()), | ||
), | ||
@@ -104,3 +106,3 @@ ); | ||
return gzip(message).then((compressedMessage) => | ||
mockServer.get('/foo').thenReply(200, compressedMessage, { | ||
mockServer.forGet('/foo').thenReply(200, compressedMessage, { | ||
'Content-Type': 'text/plain', | ||
@@ -138,3 +140,3 @@ 'X-Transfer-Length': '' + compressedMessage.length, | ||
return gzip(message).then((compressedMessage) => | ||
mockServer.get('/foo').thenReply(200, compressedMessage, { | ||
mockServer.forGet('/foo').thenReply(200, compressedMessage, { | ||
'Content-Type': 'text/plain', | ||
@@ -164,3 +166,3 @@ 'Content-Length': '' + compressedMessage.length, | ||
return gzip(message).then((compressedMessage) => | ||
mockServer.get('/foo').thenReply(200, compressedMessage, { | ||
mockServer.forGet('/foo').thenReply(200, compressedMessage, { | ||
'Content-Type': 'text/plain', | ||
@@ -190,3 +192,3 @@ 'X-Transfer-Length': '' + compressedMessage.length, | ||
const message = 'Lorem ipsum dolor sit amet'; | ||
return mockServer.get('/foo').thenReply(200, message, { | ||
return mockServer.forGet('/foo').thenReply(200, message, { | ||
'Content-Type': 'application/octet-stream', | ||
@@ -193,0 +195,0 @@ }); |
@@ -24,3 +24,3 @@ const { expect } = require('chai'); | ||
describe('given a simple GET endpoint', function () { | ||
beforeEach(() => mockServer.get(/^\/foo/).thenReply(200, 'bar')); | ||
beforeEach(() => mockServer.forGet(/^\/foo/).thenReply(200, 'bar')); | ||
@@ -101,3 +101,3 @@ describe('given the token is always fresh', function () { | ||
mockServer | ||
.get('/user/v1/refresh-token') | ||
.forGet('/user/v1/refresh-token') | ||
.thenReply(200, janeDoeFixture.token), | ||
@@ -167,3 +167,3 @@ ); | ||
mockServer | ||
.get('/user/v1/refresh-token') | ||
.forGet('/user/v1/refresh-token') | ||
.thenReply(401, 'Unauthorized'), | ||
@@ -223,3 +223,3 @@ ); | ||
beforeEach(() => | ||
mockServer.get('/user/v1/refresh-token').thenReply(500), | ||
mockServer.forGet('/user/v1/refresh-token').thenReply(500), | ||
); | ||
@@ -243,3 +243,3 @@ | ||
beforeEach(() => | ||
mockServer.get('/foo').thenReply(200, 'Lorem ipsum dolor sit amet'), | ||
mockServer.forGet('/foo').thenReply(200, 'Lorem ipsum dolor sit amet'), | ||
); | ||
@@ -300,3 +300,3 @@ | ||
return mockServer | ||
.get('/user/v1/refresh-token') | ||
.forGet('/user/v1/refresh-token') | ||
.thenReply(200, janeDoeFixture.token); | ||
@@ -303,0 +303,0 @@ }); |
@@ -16,2 +16,3 @@ { | ||
"checkJs": true, | ||
"skipLibCheck": true, | ||
"importHelpers": true | ||
@@ -18,0 +19,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
210648
4040
30
1