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

jayson

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jayson - npm Package Compare versions

Comparing version 1.0.10 to 1.0.11

lib/client/https.js

6

build/jayson.jquery.min.js

@@ -1,3 +0,3 @@

(function(c){function h(a,d,e){if("string"!==c.type(a))throw new TypeError(a+" must be a string");if(!d||!c.isPlainObject(d)&&!c.isArray(d))throw new TypeError(d+" must be an object or an array");a={jsonrpc:"2.0",params:d,method:a};a.id="undefined"===c.type(e)?Math.round(Math.random()*Math.pow(2,24)):e;return a}var b=function(a){if(!(this instanceof b))return new b(a);this.options=c.extend({dataType:"json",type:"POST",processData:!1,headers:{"content-type":"application/json"}},a||{})};window.Jayson=
b;b.prototype.request=function(a,d,e,b){var f=c.extend({},this.options,{error:function(a,d,e){b(c.makeArray(arguments))},success:function(a){b(null,a)}});try{var g=h(a,d,e);f.data=f.processData?g:JSON.stringify(g)}catch(i){return b(i)}c.ajax(f)};c.fn.jayson=function(a){a=a||{};(new b(a)).request(a.method,a.params,a.id,function(d,b){if(d){if(c.isFunction(a.error))return a.error.apply(a.error,d)}else c.isFunction(a.response)&&(2===a.response.length?b.error?a.response(b.error):a.response(null,b.result):
a.response(b))});return this};"function"===typeof define&&define("jayson",[],function(){return b})})(jQuery);
(function(c,l){function h(a,d,g,e){if("string"!==c.type(a))throw new TypeError(a+" must be a string");if(!d||!c.isPlainObject(d)&&!c.isArray(d))throw new TypeError(d+" must be an object or an array");e=e||{};a={jsonrpc:"2.0",params:d,method:a};"undefined"===c.type(g)?a.id=("function"===typeof e.generator?e.generator:f)(a):a.id=g;return a}function f(){return Math.round(Math.random()*Math.pow(2,24))}var b=function(a){if(!(this instanceof b))return new b(a);this.options=c.extend({dataType:"json",type:"POST",
processData:!1,generator:f,headers:{"Content-Type":"application/json"}},a||{})};window.Jayson=b;b.prototype.request=function(a,d,g,e){var b=c.extend({},this.options,{error:function(a,d,b){e(c.makeArray(arguments))},success:function(a,c,d){e(null,a)}});try{var f=h(a,d,g);b.data=b.processData?f:JSON.stringify(f)}catch(k){return e(k)}c.ajax(b)};c.fn.jayson=function(a){a=a||{};(new b(a)).request(a.method,a.params,a.id,{generator:a.generator},function(d,b){if(d){if(c.isFunction(a.error))return a.error.apply(a.error,
d)}else c.isFunction(a.response)&&(2===a.response.length?b.error?a.response(b.error):a.response(null,b.result):a.response(b))});return this};"function"===typeof define&&define("jayson",[],function(){return b})})(jQuery);

@@ -37,3 +37,3 @@ var Server = require('./server');

/**
* HTTP(s) client constructor
* HTTP client constructor
* @type HttpClient

@@ -45,2 +45,9 @@ * @static

/**
* HTTPS client constructor
* @type HttpsClient
* @static
*/
Client.https = require('./client/https');
/**
* Fork client constructor

@@ -47,0 +54,0 @@ * @type ForkClient

@@ -48,5 +48,6 @@ var http = require('http');

// let user override the headers
options.headers = utils.merge(headers, options.headers || {});
var req = http.request(options);
var req = self._getStream(options);

@@ -87,1 +88,11 @@ req.on('response', function(res) {

};
/**
* Gets a stream interface to a http server
* @param {Object} options An options object
* @return {require('http').ClientRequest}
* @api private
*/
HttpClient.prototype._getStream = function(options) {
return http.request(options || {});
};

@@ -19,3 +19,3 @@ var https = require('https');

var requestWrapper = utils.httpRequestWrapper.bind(this);
https.Server.call(this, requestWrapper(server));
https.Server.call(this, this.options, requestWrapper(server));
};

@@ -22,0 +22,0 @@ utils.inherits(HttpsServer, https.Server);

{
"name": "jayson",
"version": "1.0.10",
"version": "1.0.11",
"description": "JSON-RPC 2.0 compliant server and client",

@@ -5,0 +5,0 @@ "keywords": ["jsonrpc", "rpc", "json", "jsonrpc-2.0", "middleware", "connect", "express", "jquery", "fork", "cluster", "distributed", "relay"],

@@ -105,2 +105,3 @@ # Jayson

* `Client.http` HTTP interface.
* `Client.https` HTTPS interface.
* `Client.fork` Node.js child_process/fork interface.

@@ -235,3 +236,3 @@ * `Client.jquery` Wrapper around `jQuery.ajax`.

Uses the same options as [http.request][nodejs_docs_http_request] (which also enables the use of https) in addition to these options:
Uses the same options as [http.request][nodejs_docs_http_request] in addition to these options:

@@ -251,2 +252,9 @@ * `encoding` -> String that determines the encoding to use and defaults to utf8

##### Client.https
Uses the same options as [https.request][nodejs_docs_https_request] in addition _to the same options as `Client.http`_. This means it is also possible
to pass a string URL as the first argument and have it interpreted by [url.parse][nodejs_docs_url_parse].
[nodejs_docs_https_request]: http://nodejs.org/api/all.html#all_https_request_options_callback
##### Client.tcp

@@ -277,3 +285,3 @@

* `Server.http` - HTTP server that inherits from [http.Server][nodejs_doc_http_server].
* `Server.https` - HTTPS server that inherits from [https.Server][nodejs_doc_http_server].
* `Server.https` - HTTPS server that inherits from [https.Server][nodejs_doc_https_server].
* `Server.middleware` - Method that returns a [Connect][connect]/[Express][express] compatible middleware function.

@@ -280,0 +288,0 @@ * `Server.fork` Creates a child process that can take requests via `client.fork`

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