New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ministryofjustice/fb-jwt-client-node

Package Overview
Dependencies
Maintainers
5
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ministryofjustice/fb-jwt-client-node - npm Package Compare versions

Comparing version 0.0.23-a to 0.0.23-b

4

lib/fb-jwt-client.js

@@ -356,3 +356,3 @@ const prometheus = require('prom-client')

statusMessage,
body: body,
body,
retryCount

@@ -363,2 +363,3 @@ }

requestMetricsEnd(getResponseLabels(response))
response.body = response.body || '{}'
return response

@@ -377,3 +378,2 @@ }

} catch (error) {
console.log('error.response.body', error.response.body)
apiMetricsEnd(getResponseLabels(error))

@@ -380,0 +380,0 @@ if (logger) {

@@ -376,37 +376,2 @@ const test = require('tape')

const getNockedResponse = (url, response, code = 201) => {
const serviceUrl = 'http://testdomain'
const nockedClient = new FBJWTClient(serviceSecret, serviceToken, serviceSlug, serviceUrl)
nock(serviceUrl)
.get(url)
.reply(code, response)
return nockedClient.send('get', {url})
}
test('When calling an endpoint that returns json as it body', async t => {
const response = await getNockedResponse('/json-body', {success: true})
t.deepEqual(response, {success: true}, 'it should return the body')
t.end()
})
test('When calling an endpoint that returns empty json as it body', async t => {
const response = await getNockedResponse('/empty-json-body', {})
t.deepEqual(response, {}, 'it should return the body')
t.end()
})
test('When calling an endpoint that returns an empty string as it body', async t => {
const response = await getNockedResponse('/empty-string-body', {})
t.deepEqual(response, {}, 'it should return an empty json object')
t.end()
})
test('When calling an endpoint that returns an empty string as it body', async t => {
const response = await getNockedResponse('/undefined-body', {})
t.deepEqual(response, {}, 'it should return an empty json object')
t.end()
})
test('When retrying an endpoint', async t => {

@@ -467,2 +432,37 @@ const retryClient = new FBJWTClient(serviceSecret, serviceToken, serviceSlug, 'http://testdomain')

const getNockedResponse = (url, response, code = 201) => {
const serviceUrl = 'http://testdomain'
const nockedClient = new FBJWTClient(serviceSecret, serviceToken, serviceSlug, serviceUrl)
nock(serviceUrl)
.get(url)
.reply(code, response)
return nockedClient.send('get', {url})
}
test('When calling an endpoint that returns json as it body', async t => {
const response = await getNockedResponse('/json-body', {success: true})
t.deepEqual(response, {success: true}, 'it should return the body')
t.end()
})
test('When calling an endpoint that returns empty json as it body', async t => {
const response = await getNockedResponse('/empty-json-body', {})
t.deepEqual(response, {}, 'it should return the body')
t.end()
})
test('When calling an endpoint that returns an empty string as it body', async t => {
const response = await getNockedResponse('/empty-string-body', '')
t.deepEqual(response, {}, 'it should return an empty json object')
t.end()
})
test('When calling an endpoint that returns an empty string as it body', async t => {
const response = await getNockedResponse('/undefined-body')
t.deepEqual(response, {}, 'it should return an empty json object')
t.end()
})
/**

@@ -469,0 +469,0 @@ * Convenience function for testing client error handling

{
"name": "@ministryofjustice/fb-jwt-client-node",
"version": "0.0.23-a",
"version": "0.0.23-b",
"description": "Form Builder JSON Web Token Client (Node)",

@@ -5,0 +5,0 @@ "main": "lib/fb-jwt-client.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc