JSPM

@xtdev/bff-request

0.0.6
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • 0
    • Score
      100M100P100Q45373F
    • License ISC

    a http request for xiantan BFF

    Package Exports

    • @xtdev/bff-request
    • @xtdev/bff-request/dist/index.js
    • @xtdev/bff-request/index.ts

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@xtdev/bff-request) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    BFF Request

    基于axios二次封装,应用于仙潭BFF请求统一管理。

    使用

    1. 安装依赖
        npm install @xtdev/bff-request
    1. 引入使用
    import XTHttp from '@xtdev/bff-request';
    
    const request = new XTHttp('http://yourhost');
    // 请求拦截
    request.requestInterceptor(function(config){return config});
    // 响应拦截
    request.responseInterceptor(function(response){return response});
    // get请求
    request.get('/paipath', {params1: 'your request path'});
    // post请求自定义header
    request.post('/paipath', {params1: 'your request path'},{
        headers:{
            'Content-Type':'application/json'
        }
    });