npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

general-request

v0.0.30

Published

封装axios

Readme

更新日志

版本| 日期 | 内容 |修改者 -|------------|--------------------------------------|- v0.0.30| 2025-09-04 | 修复bug |charon-npm v0.0.29| 2025-09-03 | 修复bug |charon-npm v0.0.28| 2025-08-26 | 新增国际化 |charon-npm v0.0.27| 2025-01-16 | 新增自定义头部信息 |charon-npm v0.0.26| 2025-01-16 | 新增自定义头部信息 |charon-npm v0.0.25| 2025-01-16 | 新增4001码 |charon-npm v0.0.24| 2025-01-02 | 新增下载文件返回全部信息 |charon-npm v0.0.23| 2024-12-30 | 新增超时时间timeout |charon-npm v0.0.22| 2024-12-30 | 优化文件流返回的值 |charon-npm v0.0.21| 2024-09-25 | 补充请求头对应的key值 |charon-npm v0.0.20| 2024-03-05 | 优化上传文件 |charon-npm v0.0.19| 2024-03-04 | 新增请求是否自定义后台接口地址 |charon-npm v0.0.18| 2023-12-27 | 优化文档 |charon-npm v0.0.17| 2023-12-26 | 更新文档 |charon-npm v0.0.16| 2023-12-25 | 补充props.responseType='blob'时的回调数据,并不执行其他判断 |charon-npm v0.0.15| 2023-12-25 | 补充props.responseType='blob'时的回调数据 |charon-npm v0.0.14| 2023-12-12 | 更新文档 |charon-npm

使用

安装

npm install general-request --save-d

使用

import generalRequest from 'general-request'
/**axios封装
 * 使用例子:generalRequest(props, settings, localStorage, store, 'access-token', 'refresh-token')
 * @param props 对应接口配置项
 * @param settings 请求拦截设置,包括响应时间,接口地址
 * @param localStorage 用于储存token
 * @param store vue状态管理
 * @param access-token access-token key 值
 * @param refresh-token refresh-token key 值
 * */
put、post默认提交方式formData提交,其他提交方式均为json提交,需要自行设置如下:
当props.type='json'为json提交
当props.type='form-data'为formData提交
当props.type='custom-form-data'为自定义formData提交

注意:附件上传是必须files字段,里面放files数组,例如:
let body = {
    name: '张三',
    files:{
        后台字段1: [files1, files2],
        后台字段2: [files],
    }
}
自定义头部信息时,props设置如下:
{ url: '', method: 'get', data: '', params: '', headers: { 'key' : 'value' } }