Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

swagger-client

Package Overview
Dependencies
Maintainers
2
Versions
295
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

swagger-client - npm Package Compare versions

Comparing version 2.1.21 to 2.1.22

14

lib/client.js

@@ -328,7 +328,17 @@ 'use strict';

var scheme = window.location.protocol.replace(':','');
if(this.schemes.indexOf(scheme) !== -1) {
if(scheme === 'https' && this.schemes.indexOf(scheme) === -1) {
// can't call http from https served page in a browser!
helpers.log('Cannot call a http server from https inside a browser!');
this.scheme = 'http';
}
else if(this.schemes.indexOf(scheme) !== -1) {
this.scheme = scheme;
}
else {
this.scheme = 'http';
if(this.schemes.indexOf('https') !== -1) {
this.scheme = 'https';
}
else {
this.scheme = 'http';
}
}

@@ -335,0 +345,0 @@ }

2

package.json

@@ -11,3 +11,3 @@ {

"description": "swagger-client is a javascript client for use with swaggering APIs.",
"version": "2.1.21",
"version": "2.1.22",
"homepage": "http://swagger.io",

@@ -14,0 +14,0 @@ "repository": {

# Swagger JS library
[![Build Status](https://travis-ci.org/swagger-api/swagger-js.svg?branch=master)](https://travis-ci.org/swagger-api/swagger-js)
[![NPM version](https://badge.fury.io/js/swagger-client.svg)](http://badge.fury.io/js/swagger-client)

@@ -227,2 +228,42 @@ This is the Swagger javascript client for use with [swagger](http://swagger.io) enabled APIs.

### Setting headers
Headers are a type of `parameter`, and can be passed with the other parameters. For example, if you supported translated pet details via the `Accept-Language` header:
```js
"parameters": [
{
"name": "petId",
"description": "ID of pet that needs to be fetched",
"required": true,
"type": "integer",
"format": "int64",
"paramType": "path",
"minimum": "1.0",
"defaultValue": 3,
"maximum": "100000.0"
},
"LanguageHeader": {
"name": "Accept-Language",
"in": "header",
"description": "Specify the user's language",
"required": false,
"type": "string"
}
...
```
Then you would pass the header value via the parameters ([header parameters are case-insenstive](https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2)):
```js
client.pet.getPetById({
petId: 7,
'accept-language': 'fr'
}, function(pet){
console.log('pet', pet);
});
```
### Using your own HTTP client

@@ -229,0 +270,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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