postman-collection
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -105,3 +105,5 @@ var _ = require('../../util').lodash, | ||
(request.body && request.body.mode === RequestBody.MODES.urlencoded)) { | ||
request.body.urlencoded.add([].concat(signatureParams)); | ||
_.each(signatureParams, function (param) { | ||
request.body.urlencoded.add(param); | ||
}); | ||
} | ||
@@ -108,0 +110,0 @@ else { |
@@ -5,2 +5,3 @@ var util = require('../util'), | ||
mimeType = require('mime-types'), | ||
mimeFormat = require('../mime-format'), | ||
Property = require('./property').Property, | ||
@@ -123,14 +124,15 @@ Request = require('./request').Request, | ||
* { | ||
* source: 'header' // or 'content', 'default' or 'forced' | ||
* source: string // 'header', 'content', 'default' or 'forced' | ||
* type: string // the content type of response | ||
* ext: string // extension of file that stores this type of data | ||
* name: string // file name | ||
* format: 'text' // or 'audio', 'video', 'image' ... | ||
* format: string // 'text', 'audio', 'video', 'image' ... | ||
* syntax: string // 'ecmascript', 'json', 'xml', 'raw', ... | ||
* detected: {} // same as root object, but based on what is detected from content | ||
* } | ||
* | ||
* @todo write unit tests | ||
*/ | ||
mime: function (contentType, contentDisposition) { | ||
var responseBody = this.stream == null ? new Uint8Array() : this.stream, | ||
// detect the mime from response body | ||
detected = fileType(responseBody), | ||
var detected = fileType(this.stream || this.body), // detect the mime from response body | ||
source = 'forced', | ||
@@ -169,2 +171,3 @@ mime; | ||
* @returns {String} | ||
* @todo write unit tests | ||
*/ | ||
@@ -174,5 +177,10 @@ dataURI: function () { | ||
if (mime.source !== 'default' && this.stream != null) { | ||
return 'data:' + mime.type + ';base64, ' + util.bufferOrArrayBufferToBase64(this.stream); | ||
// if there is no mime detected, there is no accurate way to render this thing | ||
if (!this.mime) { | ||
return E; | ||
} | ||
// we create the body string first from stream and then fallback to body | ||
return 'data:' + mime.type + ';base64, ' + (((this.stream != null) && | ||
util.bufferOrArrayBufferToBase64(this.stream)) || ((this.body != null) && util.btoa(this.body)) || E); | ||
} | ||
@@ -196,2 +204,4 @@ }); | ||
* @returns {Object} | ||
* | ||
* @todo write unit tests | ||
*/ | ||
@@ -204,3 +214,4 @@ mimeInfo: function (type, disposition) { | ||
var info = {}; | ||
var info = {}, | ||
format = mimeFormat.lookup(type); | ||
@@ -210,3 +221,4 @@ info.type = type; | ||
info.name = DEFAULT_RESPONSE_FILENAME; // @todo return file name from disposition | ||
info.format = type.replace(/^([\s\S]+)\/[\s\S]+/g, '$1') || undefined; | ||
info.format = format.type; | ||
info.syntax = format.format; | ||
@@ -213,0 +225,0 @@ // build the file name from extension |
@@ -8,3 +8,3 @@ /* global btoa */ | ||
*/ | ||
_.mixin(/** @lends util */{ | ||
_.mixin( /** @lends util */ { | ||
@@ -158,3 +158,3 @@ /** | ||
var str = '', | ||
uArrayVal = Uint8Array.from(buffer), | ||
uArrayVal = new Uint8Array(buffer), | ||
@@ -172,3 +172,5 @@ i, | ||
bufferOrArrayBufferToBase64: function (buffer) { | ||
if (!buffer) { return ''; } | ||
if (!buffer) { | ||
return ''; | ||
} | ||
@@ -194,1 +196,2 @@ var base64; | ||
module.exports = util; | ||
@@ -5,3 +5,3 @@ { | ||
"author": "Postman Labs <help@getpostman.com>", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"keywords": [ | ||
@@ -8,0 +8,0 @@ "postman" |
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
315606
65
7919