How to use the urllib.HttpClient2 function in urllib

To help you get started, we’ve selected a few urllib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eggjs / egg-core / test / fixtures / configmeta / config / config.js View on Github external
'use strict';

const HttpClient2 = require('urllib').HttpClient2;
const urllib = new HttpClient2();

exports.urllib = {
  keepAlive: false,
  foo: null,
  bar: undefined,
  n: 1,
  dd: new Date(),
  httpclient: urllib,
};

exports.buffer = new Buffer('1234');
exports.array = [];

exports.console = console;

exports.zero = 0;
github Luncher / alipay / src / index.ts View on Github external
private makeRequest(params: AlipayPublicArgs, options: urllib.RequestOptions = {}): Promise {
    const httpclient: urllib.HttpClient2 = new urllib.HttpClient2()

    return httpclient.request(this.gateWay, { data: params, dataType: 'json', dataAsQueryString: true, ...options })
      .then((resp: urllib.HttpClientResponse) => this.makeResponse(resp.data))
  }

urllib

Help in opening URLs (mostly HTTP) in a complex world — basic and digest authentication, redirections, cookies and more. Base undici fetch API.

MIT
Latest version published 12 days ago

Package Health Score

86 / 100
Full package analysis