question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

works with "any HTTP client library" doesn't seem to be true

See original GitHub issue

I might be misunderstanding something, but when I tried to use my HTTP client library of choice (superagent) Purest hung indefinitely until I exited the process.

This works:

const request = require('request');
const purest = require('purest')({ request, promise: Promise });

This doesn’t work:

const request = require('superagent');
const purest = require('purest')({ request, promise: Promise });

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
simovcommented, Oct 6, 2018

Hi @bitinn, Grant uses request-compose under the hood. It’s my latest (and greatest) HTTP client for Node.

It’s not exactly a rewrite of request and that have never been the goal, even though the multipart, oauth and cookie ‘middlewares’ are taken straight from request. They were initially extracted out for my actual rewrite, @request/core, a few years ago. request-logs is taken from @request/log initially implemented for @request/core.

It’s possible to add request-compose as optional HTTP client here, unfortunately it can’t be set as default one without major release, because it have some differences with request, namely it’s not a duplex stream, and also it doesn’t implement the @request/interface strictly. And this is going to be yet another breaking change and not fully backward compatible version.

1reaction
simovcommented, Mar 22, 2018

I agree, though I don’t think it was intentional.

I guess I got a bit carried out with the use of the word any because it’s certainly true for Promise implementations and REST APIs, but not so much for HTTP clients apparently.

Probably I had the intention to create those wrappers, can’t tell you for sure. Currently only request and @request/client fully implement the interface. @request/core was my attempt to rewrite request long time ago, and it was covering the entire request test suit at that time, so it’s pretty stable and feature rich as it is. I always pair it with Purest, however the code base suffers from other issues and I can’t recommend using it because no one is maintaining it. You can try it out of course and see if it works for you as it is.

Anyway, thanks for your feedback! I’m going to update the readme and phrase it more correctly. 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

HttpClient PostAsync does not return - Stack Overflow
You can use this var json = JsonConvert.SerializeObject(card); using (var client = new HttpClient()) { var t = await client.
Read more >
You're using HttpClient wrong and it is destabilizing your ...
I've been using HttpClient wrong for years and it finally came back to bite me. My site was unstable and my clients furious,...
Read more >
How to use ArduinoJson with HTTPClient?
HTTPClient is a class that performs HTTP requests on ESP8266 and ESP32. Assuming that the board is connected to the WiFi network, you...
Read more >
HttpClient does not use HTTP proxy when client options ssl ...
I am trying to use the http client in order to access several restful apis through my proxy. Some of the api providers...
Read more >
HttpClient SSL Guide
Work-around: One possible solution is to increase the timeout value as the server is taking too long to start sending the response. Alternatively...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found