Questions tagged [superagent]

410 questions
2
votes
1 answer

Vuejs $emit didn't trigger parent's function on callback

My question is just like this one:Vuejs $emit doesn't fire on callback. But I used the superagent in my project. Here is my code: //Parent.vue ... methods:{ toSaveVideo:function(data){ console.log('add'); …
JessieZhou
  • 163
  • 1
  • 1
  • 6
2
votes
1 answer

File download using SuperAgent

I'm trying to download files from server using SuperAgent. Please find the code below. downloadDocument(fileIdMongo) { var request = require('superagent'); var apiBaseUrl = "api/downloadDoc"; var self = this; var req =…
user8352964
2
votes
2 answers

how to use superagent-proxy?

I find it hard to use superagent-proxy, just with the simple code: const superagent = require('superagent') require('superagent-proxy')(superagent) let proxy = 'http://221.237.122.22:8118' // 设置代理 superagent .get('http://sf.gg') .proxy(proxy) …
hanzichi
  • 609
  • 2
  • 12
  • 22
2
votes
2 answers

bad content-type header, no multipart boundary nodejs

I have an API that returns content with content-type: "multipart/form-data; charset=utf-8". However, in my nodejs app, when I make the following call through superagent: request .get(ApiUrl + id) .set('Authorization', basicHttpAuth) …
HelmBurger
  • 1,168
  • 5
  • 15
  • 35
2
votes
4 answers

Difference between Postman and a simple Http Request with superagent

I was wondering what's the difference between a simple POST request with superagent and a POST request with Postman. Because Im trying to scrap a website, so I made a post request with Postman and everythings work fine, I got the result expected.…
Paul
  • 101
  • 1
  • 1
  • 12
2
votes
1 answer

Iterate Array of Objects, and save each to MongoDB

I want to save/insert each Object from the Array into my MongoDB, after receiving it from a Facebook endpoint. How would I iterate over the returned Array of Objects and then save it to my mongoDB? :) Code from my Route, where I receive the data…
DbTheChain
  • 225
  • 2
  • 4
  • 13
2
votes
2 answers

minio presigned put with superagent results in a 403

I'm attempting to write a basic test to make sure my minio installation works correctly. I wrote a test that follows their example of using a presigned POST policy and it works just fine, but I cannot seem to create a working example of a presigned…
Paul S
  • 892
  • 10
  • 25
2
votes
1 answer

Basic authentication : failure supergaent+OSX , success on superagent+Redhat , success on Postman+OSX,

Using POSTMAN , everything is fine : I pass the same headers,params,... to superagent as following : const superagent = require('superagent'); const grab = require('ps-grab'); superagent.get('https://x.rathath.net/issue_statuses.json') …
Abdennour TOUMI
  • 87,526
  • 38
  • 249
  • 254
2
votes
3 answers

supertest test with jwt header token

I'm have some issue in my test with superagent and express.js. it('should 200 with valid login', (done) => { console.log(createdUser[`${validUser.email}`]['token']); // JWT…
imalik8088
  • 1,501
  • 5
  • 21
  • 39
2
votes
1 answer

Laravel 5.3 Returns 302 with Request Validation - Ajax Request

I am having trouble with an ajax request to a Laravel application, specifically making a POST request to an authentication controller. I'm sending a post request with SuperAgent to a controller that uses a Request class to validate the input. The…
Andres Zapata
  • 1,710
  • 1
  • 16
  • 32
2
votes
0 answers

Do I have to use `setTimeout` to test async code of a react component in tests?

I have a react form which sends a request to backend when the form is submitted: import React, {Component} from 'react'; import request from 'superagent'; export default class RegisterForm extends Component { constructor(props) { …
Freewind
  • 193,756
  • 157
  • 432
  • 708
2
votes
1 answer

nodejs download image with superangent ,check the file size

... superagent .get(req.body.img) .set('User-Agent', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.99 Safari/537.36') …
郭金昀
  • 29
  • 1
  • 5
2
votes
3 answers

setState from an API response using superagent and React

I get an error when trying to change the state of a component. Uncaught TypeError: Cannot read property 'setState' of undefined constructor(props){ super(props); this.state={ r:'', message:'' }; …
Ando
  • 1,802
  • 4
  • 25
  • 47
2
votes
0 answers

Rails-API not finding superagent request

I'm setting up a Rails-API backend with a React front end, and I'm having some issues sending the requests properly. Here is the WebApi module inthrough which a user logs in. import request from 'superagent'; import ApiEndpoints from…
Steve Zelaznik
  • 616
  • 7
  • 16
2
votes
0 answers

Chaining requests with Superagent without Mocha

This question talks about chaining requests but it is using mocha. How can I chain superagent requests (calling another rest API in the end method) without using Mocha or it? When I do the chaining superagent.post( URL ).send( DATA ).end(…
gurvinder372
  • 66,980
  • 10
  • 72
  • 94