New:Microsoft Teams Notifications Are Now Available in Socket.Learn more
Get Started

@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

beta
Source
npmnpm
Version
0.2.2-beta.0
Version published
Maintainers
1
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 17 Sep 2023

Related posts