Giter Club home page Giter Club logo

axios-digest's Introduction

axios-digest

axios-digest is axios add digest auth.

Installation

npm install --save axios-digest

Usage

See test code. (index.test.ts) It pretty much is a wrapper around Axios. the primary or most commonly-used HTTP methods only are available -> POST, PUT, PATCH, GET, DELETE, HEAD. See below for usage upfront (It was inspired from the test file).

AxiosDigest Constructor AxiosDigest(username: string, passwd: string, customAxios: AxiosInstance|AxiosStatic)

Parameters

  • username: Not optional | string.
  • password: Not optional | string.
  • customAxios: Optional. An existing axios instance | AxiosInstance|AxiosStatic.
import AxiosDigest from '.';

const username = '[username]';
const passwd = '[pass]';

const base = 'http://localhost';

const axiosDigest = new AxiosDigest(username, passwd);
// Go ahead and make them request!

Fields && Methods

axiosDigest.info

Interface for setting the username && password beyond the constructor. It does not include a custom Axios instance as in the constructor. It receives an object and the fields username && passwd are not Optional, and returns the same, only that the value for field passwd is masked.

axiosDigest.info = { username, passwd };
const info = axiosDigest.info; // { username: '[username]', passwd: '***' }

axiosDigest[HTTP_METHODS]

The HTTP Methods available have been previously highlighted and returns a Promise.

Similar Parameters

  • path: Not optional | string.
  • data: Optional | any.
  • config: Optional | AxiosRequestConfig.

axiosDigest.head

Makes a HEAD request.

axiosDigest.head(path: string, config?: AxiosRequestConfig): Promise<any>;

axiosDigest.delete

Makes a DELETE request.

axiosDigest.delete(path: string, config?: AxiosRequestConfig): Promise<any>;

axiosDigest.get

Makes a GET request.

axiosDigest.get(path: string, config?: AxiosRequestConfig): Promise<any>;

axiosDigest.patch

Makes a PATCH request.

axiosDigest.get(path: string, data: any, config?: AxiosRequestConfig): Promise<any>;

axiosDigest.put

Makes a PUT request.

axiosDigest.put(path: string, data: any, config?: AxiosRequestConfig): Promise<any>;

axiosDigest.post

Makes a POST request.

axiosDigest.post(path: string, data: any, config?: AxiosRequestConfig): Promise<any>;

License

MIT

axios-digest's People

Contributors

rearn avatar dependabot[bot] avatar andrewbird81 avatar freakyhead avatar danglebary avatar whizyrel avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.