# @sdp.nd/request-adapter-waf

针对 [REST proxy 方案](http://wiki.sdp.nd/index.php?title=REST_proxy_%E6%96%B9%E6%A1%88) 做简单的处理

同时提供兼容 IE8/9 的 (axios)[https://github.com/axios/axios] 适配器及工具函数 `isXDomain`, `buildURL`

## install
```
  npm i @sdp.nd/request-adapter-waf -S
```

## usage
``` js
  import { isXDomain, convertRequest, convertResponse, xhrAdapter } from '@sdp.nd/request-adapter-waf'
  import axios from 'axios'

  const url = 'http://localhost:8080'
  const xDomain = isXDomain(url) // 是否使用 xDomain 跨域

  const convertedReq = convertRequest(config) // 对请求做处理，参数为 axios 的 config

  const convertdRes = convertResponse(response) // 对返回值做处理，参数为 axios 的返回值

  axios.get(url, {
    adapter: xhrAdapter // 兼容 IE8/9 的适配器  axios@0.18.1 开始的版本不再兼容 IE8/9
  })
```
