0.2.14 • Published 4 years ago

https-adapter v0.2.14

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

https-adapter

A module for making configured HTTPS requests

Usage

Install it by:

  • npm install --save https-adapter
  • yarn add https-adapter

Create all needed configuration for your HTTPS request and then invoke makeRequest():

let httpsConfig: IHttpsConfiguration = {
    baseUrl: 'hostname.com',
    pathname: '/',
    headers: {
        "Content-Type": "application/json"
    },
    method: GET
};

// Output logs to console.log();
let response: IHttpResponse = await makeRequest(httpsConfig, true);

Types definitions

declare namespace httpsRepository
{
    interface IHttpsConfiguration
    {
        baseUrl: string;
        pathname: string;
        method: string;
        headers: OutgoingHttpHeaders;
        queryString?: string;
        payload?: any;
    };

    interface IHttpResponse
    {
        statusCode: number;
        body: string;
        headers?: IncomingHttpHeaders;
    };
    
    interface IAws4Configs
    {
        service: string;
        region: string;
        secret: any;
        key: any;
    };
    // Regular Requests
    function makeRequest(httpsConfig: IHttpsConfiguration, showLogs?: boolean): Promise<IHttpResponse>;
    // AWS4 Signed Requests
    function makeAws4SignedRequest(aws4Config: IAws4Configs, httpsConfig: IHttpsConfiguration, showLogs?: boolean): Promise<IHttpResponse>;
}
0.2.14

4 years ago

0.2.13

4 years ago

0.1.13

4 years ago

0.1.11

4 years ago

0.1.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago