Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including url-request with all npm packages installed. Try it out:

var urlRequest = require("url-request")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

url-request v1.0.13

A HTTP Client and Url Builder with Functional Chaining, Async/Await and Fork.


Generic badge Generic badge Generic badge Generic badge

The most advanced HTTP Client and Url Builder with Functional Chaining, Async/Await, Delay, Fork, Infinite Chaining and Repeat for building your Complex APIs easily.

Alternative to Requests, Axios, and Got.


npm install url-request --save


const Url = require('url-request')


Look Examples


Building a Ping server was never as easy! This pings at an interval of 1s and let's you know if you're connected or not.

  .then(() => console.log('Ping Successful! Internet is up 🤟')) 
  .catch(() => console.log('Ping Failed! Internet is down 😭'))
  .repeat(1000, 100) // time 1000ms

GET Request w/ Promise

Send a GET request with an access token, then display the result or catch errors. GET

  .query({ access_token: 'MyAccessToken' })
  .get() // GET Request
  .then(json => console.log(json)) 
  .catch(err => console.error('[Error]', err))
[{ id: 1, post: 'Post 1' },
 { id: 2, post: 'Post 2' }]

Build A Complex Url

Build Complex Urls with deep paths, multiple queries (lists are supported) and fragments.

const url = Url('')
  .go('rooms', 'open', 'users')
  .query({ id: [10, 12, 13, 14] })
  .query({ access_token: 'my-token', password: 'password'})
// access_token=my-token&password=password#bio

Invoke / Execute

  .invoke('go', 'post')
  .invoke('encodeResponse', null) // To Get Full Response Object
  .invoke('post', { foo1: 'bar1', foo2: 'bar2' })
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err))


const userApi = Url('')
  .go('user', 123)

const subscriptionsApi = userApi

const achievementsApi = userApi

[ userApi, subscriptionsApi, achievementsApi ]
  .forEach(api => api
    .then(json => console.log(json))
    .catch(err => console.log(err)))

POST Request w/ Promise

A POST request with a body { subscrbe: 'Apple Music' } at

  .go('user', 123)
  .post({ subscrbe: 'Apple Music' })
  .then(json => console.log(json)) // { success: true }
  .catch(err => console.error(err))


const post = async () => {
  const request = Url('')
    .post({ foo1: 'bar1', foo2: 'bar2' })
  return await request


Delay your requests!

  .delay(2000, () => console.log('Wait 2s'))
  .post({ foo1: 'bar1', foo2: 'bar2' })

Infinite Chain

See Infinite Chain Example

  .then(json => console.log('[1]', json)) 
  .catch(err => console.error('[Error]', err))
  .then(json => console.log('[2]', json)) 
  .catch(err => console.error('[Error]', err))
  ... // Keep on going!


class Url {

  // Url Construction
  constructor (baseUri) // Start with the baseUri
  go (...paths) // Go to Sub Path
  query (q) // q is query object
  fragment (f) // add fragments like #profile

  // Fork
  fork ()
  // default encoding is 'json', can be null, 'string', 'buffer'
  encodeResponse (encoding) 
  // Set headers
  header (headers) 

  // get the formed url as a string
  get url ()

  // Requests
  get (body, statusCode) // GET Request
  post (body, statusCode) // POST Request
  put (body, statusCode) // PUT Request
  delete (body, statusCode) // DELETE Request
  patch (body, statusCode) // PATCH Request

  then (func)
  catch (func)
  finally (func)

  delay (time, func)
  repeat (time, count)

  // Command Control, Lazy Execution
  invoke (command, ...args)
  execute (invokeCommands)


  • [ ] OAuth
  • [ ] HTTP2
  • [ ] Proxy
  • [ ] Compression
  • [ ] Timeout Handling
  • [ ] Custom Hooks
  • [ ] Request Cancellation
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free