forked from loafle/openapi-generator-original
parent
fa052ffa19
commit
c7fa44cd0c
@ -88,9 +88,15 @@
|
|||||||
* Check if the given parameter value is like file content.
|
* Check if the given parameter value is like file content.
|
||||||
*/
|
*/
|
||||||
ApiClient.prototype.isFileParam = function isFileParam(param) {
|
ApiClient.prototype.isFileParam = function isFileParam(param) {
|
||||||
// Buffer or fs.ReadStream in Node.js
|
// fs.ReadStream in Node.js (but not in runtime like browserify)
|
||||||
if (typeof module === 'object' && module.exports &&
|
if (typeof window === 'undefined' &&
|
||||||
(param instanceof Buffer || param instanceof require('fs').ReadStream)) {
|
typeof require === 'function' &&
|
||||||
|
require('fs') &&
|
||||||
|
param instanceof require('fs').ReadStream) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// Buffer in Node.js
|
||||||
|
if (typeof Buffer === 'function' && param instanceof Buffer) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Blob in browser
|
// Blob in browser
|
||||||
|
@ -88,9 +88,15 @@
|
|||||||
* Check if the given parameter value is like file content.
|
* Check if the given parameter value is like file content.
|
||||||
*/
|
*/
|
||||||
ApiClient.prototype.isFileParam = function isFileParam(param) {
|
ApiClient.prototype.isFileParam = function isFileParam(param) {
|
||||||
// Buffer or fs.ReadStream in Node.js
|
// fs.ReadStream in Node.js (but not in runtime like browserify)
|
||||||
if (typeof module === 'object' && module.exports &&
|
if (typeof window === 'undefined' &&
|
||||||
(param instanceof Buffer || param instanceof require('fs').ReadStream)) {
|
typeof require === 'function' &&
|
||||||
|
require('fs') &&
|
||||||
|
param instanceof require('fs').ReadStream) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// Buffer in Node.js
|
||||||
|
if (typeof Buffer === 'function' && param instanceof Buffer) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Blob in browser
|
// Blob in browser
|
||||||
|
Loading…
x
Reference in New Issue
Block a user