serviejs / popsicle

Simple HTTP requests for node and the browser
MIT License
246 stars 19 forks source link

Export common.toFetch #129

Closed postatum closed 5 years ago

postatum commented 5 years ago

Hi! Thank you for a nice lib. If this PR is ok, please release this change asap because it blocks upgrading popsicle version in multiple of our libs.

Readme section Customization says:

Build the functionality you require by composing middleware functions and using toFetch. See src/node.ts for an example.

But it's impossible to do because toFetch is not exported. I've tested it using node v12.5.0. Before:

> require('popsicle')
{
  Signal: [Function: Signal],
  AbortController: [Function: AbortController],
  Headers: [Function: Headers],
  fetch: [Function: fetch],
  middleware: [Function: composedDebug]
}

After this pr:

> require('popsicle')
{
  toFetch: [Function: toFetch],
  Signal: [Function: Signal],
  AbortController: [Function: AbortController],
  Headers: [Function: Headers],
  fetch: [Function: fetch],
  middleware: [Function: composedDebug]
}
coveralls commented 5 years ago

Pull Request Test Coverage Report for Build 643


Totals Coverage Status
Change from base Build 640: 0.6%
Covered Lines: 28
Relevant Lines: 31

💛 - Coveralls
blakeembrey commented 5 years ago

@postatum You're welcome to import from common directly (the API will remain stable here since I'm supporting it for {browser,node} too). However, agree this is a good idea and mirrors the {node,browser} entry points 👍

postatum commented 5 years ago

@postatum You're welcome to import from common directly (the API will remain stable here since I'm supporting it for {browser,node} too). However, agree this is a good idea and mirrors the {node,browser} entry points +1

Got it. Thank you for making a release.