MD. Jahidul Islam
MD. Jahidul Islam

Reputation: 655

intercept network request using fiddler in sails.js

I've a sails.js app which makes api request in third party (for an example marketo api) to get data.

Is there any way that I can set a proxy in sails.js so that I can see all the request made by sail.js app into the fiddler.

By the way my os is ubuntu 14.04 and I'm using mono to run fiddler

Upvotes: 0

Views: 333

Answers (1)

gnuns
gnuns

Reputation: 626

It depends on how you are making your API requests.

If you are using request, you can set the proxy details this way:

let request = require('request');
// using default fiddler port
let proxiedRequest = request.defaults({'proxy': 'http://127.0.0.1:8888'});

proxiedRequest.get("http://api.example.com/foo", function (err, resp, body) {
  ...
})

If you are using the node http client, check "How can I use an http proxy with node.js http.Client?"

Upvotes: 1

Related Questions