mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-08 03:18:53 +00:00
parent
fa052ffa19
commit
c7fa44cd0c
@ -88,9 +88,15 @@
|
||||
* Check if the given parameter value is like file content.
|
||||
*/
|
||||
ApiClient.prototype.isFileParam = function isFileParam(param) {
|
||||
// Buffer or fs.ReadStream in Node.js
|
||||
if (typeof module === 'object' && module.exports &&
|
||||
(param instanceof Buffer || param instanceof require('fs').ReadStream)) {
|
||||
// fs.ReadStream in Node.js (but not in runtime like browserify)
|
||||
if (typeof window === 'undefined' &&
|
||||
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;
|
||||
}
|
||||
// Blob in browser
|
||||
|
@ -88,9 +88,15 @@
|
||||
* Check if the given parameter value is like file content.
|
||||
*/
|
||||
ApiClient.prototype.isFileParam = function isFileParam(param) {
|
||||
// Buffer or fs.ReadStream in Node.js
|
||||
if (typeof module === 'object' && module.exports &&
|
||||
(param instanceof Buffer || param instanceof require('fs').ReadStream)) {
|
||||
// fs.ReadStream in Node.js (but not in runtime like browserify)
|
||||
if (typeof window === 'undefined' &&
|
||||
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;
|
||||
}
|
||||
// Blob in browser
|
||||
|
Loading…
Reference in New Issue
Block a user