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

iboot-http-client

v1.1.3

Published

iBoot.xin 相关应用的客户端Http封装

Readme

iboot-http-client

中文简介:

iboot-http-client 是一个轻量的 HTTP 客户端库,旨在帮助开发者快速接入并使用 iCMS 系统的 API。它封装了常见的请求/响应处理、鉴权与类型声明,适用于 TypeScript 在浏览器或 Node.js 环境中的调用场景。

English Summary:

iboot-http-client is a lightweight HTTP client library designed to help developers quickly integrate with the iCMS system API. It wraps common request/response handling, authentication and TypeScript typings for both browser and Node.js usage.

主要目标 / Goals

  • 简化调用 iCMS API 的流程 / Simplify calling iCMS APIs
  • 提供 TypeScript 类型支持 / Provide TypeScript typings
  • 支持全局配置、拦截器与鉴权扩展 / Support global config, interceptors and auth

特性 / Features

  • 基于 Fetch 封装,兼容浏览器与 Node(可按需替换实现) / Built on Fetch, compatible with browser and Node (swapable)
  • 全局 baseURL、默认 headers、自动注入 token / Global baseURL, default headers, automatic token injection
  • 请求/响应拦截器支持 / Request/response interceptor support
  • 类型声明文件位于 index.d.ts / Type declarations available in index.d.ts

安装 / Install

使用 npm:

npm install iboot-http-client

或使用 pnpm / yarn:

pnpm add iboot-http-client
yarn add iboot-http-client

快速开始 / Quick Start

示例(TypeScript):

import { HttpClient } from 'iboot-http-client'

const client = new HttpClient({
	baseURL: 'https://api.your-icms.com',
	headers: { 'Content-Type': 'application/json' },
	token: 'your-access-token',
})

// GET example
const list = await client.get('/articles', { params: { page: 1, pageSize: 10 } })

// POST example
const created = await client.post('/articles', { title: 'Example', body: 'Content' })

console.log(list, created)

更多方法签名与配置请参阅 src/HttpClient.tsindex.d.ts

配置项 / Options

  • baseURL:iCMS API 根地址 / iCMS API base URL
  • headers:默认请求头 / Default request headers
  • token:认证令牌(会注入到请求头)/ Auth token (automatically injected)
  • timeout(可选):请求超时时间 / Optional request timeout

错误处理 / Error Handling

客户端在网络错误或非 2xx 响应时会抛出异常。请使用 try/catch 处理:

try {
	await client.get('/protected')
} catch (err) {
	// handle auth failure, network error or business errors
}

开发与贡献 / Contributing

  • 欢迎提交 issue 或 PR。请在 issue 中描述重现步骤与期望行为。
  • 新特性建议请先在 issue 中讨论。

本项目遵循仓库根目录的 LICENSE 文件。


如需我将 README 中的中文或英文内容扩展为更详细的使用示例(例如:鉴权流程、拦截器实现、错误码映射),或把 README 同步到包的 package.jsonhomepagerepository 字段,请告诉我。