🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@ferry-core/oar

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ferry-core/oar

A RESTful HTTP request lib with default config

Source
npmnpm
Version
0.0.2
Version published
Weekly downloads
23
360%
Maintainers
1
Weekly downloads
 
Created
Source

@ferry-core/oar Oar

Sponsor TypeScript version Node.js version MIT

By YanPan

基于 axios 的 RESTful 网络请求库.

✨ Oar 配置

Oar 是基于 Axios 的扩展网络请求库,兼容 Axios 基本用法,并对部分 Axios 的默认配置进行了封装和扩展:

| 参数 | 类型 | default | 说明 | | --------------- | ------- | ------------- | -------------------------- | ------------------------------- | | allowCsrf | boolean | true | 默认 post 请求带 csrf 参数 | | csrfKeyName | string | Array | ['csrf_token', 'csrf'] | post 请求的自定义 csrf 校验字段 | | withCredentials | boolean | true | 默认允许带 cookie |

✨ Oar 默认拦截器

Oar 默认设置了请求及响应拦截器,提供了以下功能:

request 拦截器

  • http 协议强制转动态协议
  • POST 请求参数序列化,以 application/x-www-form-urlencoded 格式发送
  • CSRF 防御

response 拦截器

  • 默认errorHandler错误打印
  • 设置接口缓存(已舍弃)

🚀 快速开始

安装

npm i -D @ferry-core/oar # 或 yarn add -D @ferry-core/oar

License

MIT

Keywords

oar

FAQs

Package last updated on 23 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts