fulcrum-app
Advanced tools
Comparing version 2.0.0-alpha.3 to 2.0.0-alpha.4
@@ -89,2 +89,4 @@ 'use strict'; | ||
this.version = VERSION; | ||
var options = { | ||
@@ -91,0 +93,0 @@ baseURI: this.baseUrl, |
@@ -74,5 +74,20 @@ 'use strict'; | ||
formData.append(this.resourceName + '[access_key]', attrs.access_key || _uuid2.default.v4()); | ||
formData.append(this.resourceName + '[file]', file); | ||
var accessKey = attrs.hasOwnProperty('accessKey') ? attrs.accessKey : _uuid2.default.v4(); | ||
formData.append(this.resourceName + '[access_key]', accessKey); | ||
var fileOptions = null; | ||
// File names from media streams like | ||
// fs.createReadStream('photo.jpg') | ||
// are automatically added. When reading from buffers like | ||
// fs.readFileSync('photo.jpg) | ||
// the file name can't be inferred so it must be supplied like | ||
// photos.create(fs.readFileSync('photo.jpg'), {fileName: 'photo.jpg'}) | ||
if (attrs.hasOwnProperty('fileName')) { | ||
fileOptions = { filename: attrs.fileName }; | ||
} | ||
formData.append(this.resourceName + '[file]', file, fileOptions); | ||
return { | ||
@@ -79,0 +94,0 @@ body: formData, |
{ | ||
"name": "fulcrum-app", | ||
"version": "2.0.0-alpha.3", | ||
"version": "2.0.0-alpha.4", | ||
"description": "JavaScript wrapper for the Fulcrum API", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -28,2 +28,4 @@ import Fetcher from './fetcher'; | ||
this.version = VERSION; | ||
const options = { | ||
@@ -30,0 +32,0 @@ baseURI: this.baseUrl, |
@@ -64,2 +64,3 @@ function getQueryString(params) { | ||
const contentType = resp.headers.get('Content-Type'); | ||
if (contentType && contentType.split(';')[0] === 'application/json') { | ||
@@ -66,0 +67,0 @@ return resp.json(); |
@@ -16,5 +16,20 @@ import uuid from 'uuid'; | ||
formData.append(`${this.resourceName}[access_key]`, attrs.access_key || uuid.v4()); | ||
formData.append(`${this.resourceName}[file]`, file); | ||
const accessKey = attrs.hasOwnProperty('accessKey') ? attrs.accessKey : uuid.v4(); | ||
formData.append(`${this.resourceName}[access_key]`, accessKey); | ||
let fileOptions = null; | ||
// File names from media streams like | ||
// fs.createReadStream('photo.jpg') | ||
// are automatically added. When reading from buffers like | ||
// fs.readFileSync('photo.jpg) | ||
// the file name can't be inferred so it must be supplied like | ||
// photos.create(fs.readFileSync('photo.jpg'), {fileName: 'photo.jpg'}) | ||
if (attrs.hasOwnProperty('fileName')) { | ||
fileOptions = { filename: attrs.fileName }; | ||
} | ||
formData.append(`${this.resourceName}[file]`, file, fileOptions); | ||
return { | ||
@@ -21,0 +36,0 @@ body: formData, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
1396948
3024
372
93