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

@lion/ajax

Package Overview
Dependencies
Maintainers
3
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lion/ajax - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

2

package.json
{
"name": "@lion/ajax",
"version": "1.1.2",
"version": "1.1.3",
"description": "Thin wrapper around fetch with support for interceptors.",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -196,3 +196,6 @@ /* eslint-disable consistent-return */

let body = responseText;
if (response.headers.get('content-type')?.includes('json')) {
if (
!response.headers.get('content-type') ||
response.headers.get('content-type')?.includes('json')
) {
try {

@@ -199,0 +202,0 @@ body = JSON.parse(responseText);

@@ -169,2 +169,19 @@ import { expect } from '@open-wc/testing';

it('tries to parse Response body as JSON if the content-type header is missing', async () => {
fetchStub.restore();
fetchStub = stub(window, 'fetch');
fetchStub.callsFake(() => {
const resp = new Response('{"a":1,"b":2}', {
headers: {
// eslint-disable-next-line no-plusplus
'x-request-id': `${responseId++}`,
},
});
resp.headers.delete('content-type');
return Promise.resolve(resp);
});
const response = await ajax.fetchJson('/foo');
expect(response.body).to.eql({ a: 1, b: 2 });
});
describe('given a request body', () => {

@@ -171,0 +188,0 @@ it('encodes the request body as json', async () => {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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