Upload a file to server using NodeJS and Swagger
I want to upload a file to a server using Swagger. I have created the YAML to upload file as follows: /Upload: post: summary: Uploads a file. operationId: bulkUpload consumes: - multipart/form-data parameters: - in: formData name: upfile type: file description: The file to upload. responses: 200: description: "File Uploaded" x-swagger-router-controller: "Default" My DefaultService.js file contaians the function: var fs = require('fs'); exports.bulkUpload = function(args, res, next) { var stream = fs.createWriteStream("UploadedFile.txt"); stream.once('open', function () { stream.write('blah blah'); //works - writes 'blah blah' to file stream.write(JSON.stringify(args.upfile.value));//bombs out after a while stream.write(args.upfile); //does not work stream.write(args.upfile.value); //does not work stream.end(); }); res.setHeader('Content-Type', 'application/json'); res.statusCode = 200; res.end(JSON.stringify('File Uploaded')); } I want to upload the original file without having to create my own test file. How can I do this? You will see that I am trying to write the uploaded file to a test file "UploadedFile.txt". It is currently failing as you can see from my attempts.3.8KViews0likes0CommentsUnable to connect to BitBar via automation script using appium + NodeJS + WebdriverIO
Hello team, We are trying to connect to smartbear - bitbar for mobile automation using nodeJS - wdio5. Since this is for automation POC we are using the config file from: https://github.com/bitbar/test-samples/blob/master/samples/testing-frameworks/appium/client-side/javascript/webdriver.io/wdio.conf.js While connecting we are getting error as : [0-0] 2022-08-24T16:18:54.762Z WARN webdriver: Request failed due to <html> <head><title>405 Not Allowed</title></head> <body> <center><h1>405 Not Allowed</h1></center> <hr><center>nginx/1.21.6</center> </body> </html> [0-0] 2022-08-24T16:18:54.762Z INFO webdriver: Retrying 1/3 2022-08-24T16:18:54.762Z INFO webdriver: [POST] https://cloud.bitbar.com/#testing/dashboard:443%5Cwd%5Chub%5Csession Can anyone suggest how to correct this? Appreciate any help1KViews0likes3Comments