mappersmith
Advanced tools
Comparing version 2.22.1 to 2.22.2
@@ -17,2 +17,4 @@ 'use strict'; | ||
var REGEXP_EMULATE_HTTP = /^(delete|put|patch)/i; | ||
function Gateway(request) { | ||
@@ -36,3 +38,3 @@ var configs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
shouldEmulateHTTP: function shouldEmulateHTTP() { | ||
return this.options().emulateHTTP && /^(delete|put|patch)/i.test(this.request.method()); | ||
return this.options().emulateHTTP && REGEXP_EMULATE_HTTP.test(this.request.method()); | ||
}, | ||
@@ -39,0 +41,0 @@ call: function call() { |
@@ -18,3 +18,3 @@ 'use strict'; | ||
/* global VERSION */ | ||
var version = exports.version = '2.22.1'; | ||
var version = exports.version = '2.22.2'; | ||
@@ -21,0 +21,0 @@ var configs = exports.configs = { |
@@ -16,2 +16,8 @@ 'use strict'; | ||
return function CsrfMiddleware() { | ||
var REGEXP_COOKIE_NAME = new RegExp(cookieName + '[^;]+'); | ||
var getCookie = function getCookie() { | ||
var cookieString = REGEXP_COOKIE_NAME.exec((document || {}).cookie || ''); | ||
return cookieString ? decodeURIComponent(cookieString.toString().replace(/^[^=]+./, '')) : undefined; | ||
}; | ||
return { | ||
@@ -23,9 +29,4 @@ request: function request(_request) { | ||
var getCookie = function getCookie(cookieName) { | ||
var cookieString = new RegExp(cookieName + '[^;]+').exec((document || {}).cookie || ''); | ||
return cookieString ? decodeURIComponent(cookieString.toString().replace(/^[^=]+./, '')) : undefined; | ||
}; | ||
var csrf = getCookie(); | ||
var csrf = getCookie(cookieName); | ||
return !csrf ? _request : _request.enhance({ | ||
@@ -32,0 +33,0 @@ headers: _defineProperty({}, headerName, csrf) |
{ | ||
"name": "mappersmith", | ||
"version": "2.22.1", | ||
"version": "2.22.2", | ||
"description": "It is a lightweight rest client for node.js and the browser", | ||
@@ -5,0 +5,0 @@ "author": "Tulio Ornelas <ornelas.tulio@gmail.com>", |
@@ -9,3 +9,4 @@ 'use strict'; | ||
var REGEXP_DYNAMIC_SEGMENT = new RegExp('{([^}]+)}'); | ||
var REGEXP_DYNAMIC_SEGMENT = /{([^}]+)}/; | ||
var REGEXP_TRAILING_SLASH = /\/$/; | ||
@@ -61,3 +62,3 @@ /** | ||
host: function host() { | ||
return (this.methodDescriptor.host || '').replace(/\/$/, ''); | ||
return (this.methodDescriptor.host || '').replace(REGEXP_TRAILING_SLASH, ''); | ||
}, | ||
@@ -64,0 +65,0 @@ |
@@ -11,2 +11,4 @@ 'use strict'; | ||
var REGEXP_CONTENT_TYPE_JSON = /^application\/json/; | ||
/** | ||
@@ -117,4 +119,3 @@ * @typedef Response | ||
isContentTypeJSON: function isContentTypeJSON() { | ||
return (/application\/json/.test(this.headers()['content-type']) | ||
); | ||
return REGEXP_CONTENT_TYPE_JSON.test(this.headers()['content-type']); | ||
}, | ||
@@ -121,0 +122,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
110615
2144