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 🙏

© 2024 – Pkg Stats / Ryan Hefner

htte-client-http

v0.5.1

Published

http client plugin for htte

Downloads

20

Readme

HTTP

该客户端用采用 HTTP 协议与接口服务进行通讯。

目前仅支持 JSON 这种数据交换格式。后期后陆续加入 xml, multipart/form-data

安装

该客户端插件默认安装,不需要用户单独安装。

配置

- name: http
  pkg: htte-client-http
  options:
    baseUrl: http://example.com # 接口的基础路径,与 用例 `req.url` 拼接得到接口的完整访问路径
    timeout: 3000 # 请求超时

用例

- describe: http test
  req:
    url: /math/{act} # 接口路径,如果配置中有定义 `baseUrl`,此处可以使用相对路径。
    method: put # 支持方法有: get, delete, head, options, post, put, patch; 大小写不敏感
    headers: # 请求头
      Authorization: Bearer ....
      X-Custom-Head: abc
    params: # 路径变量,用来补全 `url` 中的对应 `{\w+}` 部分,本例中 `url` 补全为 `/p/model/33`
      act: add
    query: #  查询字符串变量,本例中将生成查询字符串 `?size=20&page=3`
      size: 20
      page: 3
    type: json # 请求数据格式, 将添加请求头 `application/json; charset=utf-8`,并以 JSON 格式封装 `body` 中的数据。
    body: # 请求数据,结合 `type: json`,数据将已 `{"a":3,"b":4}` 的形式传递给接口服务。
      a: 3
      b: 4
    timeout: 1000 # 超时,覆盖配置中的全局超时设置。
  res:
    status: 200 # HTTP 响应码
    headers: # 响应头
        Expires: Wed, 18 Jul 2018 15:27:44 GMT
    body: # 相应数据, 将根据响应头 `Content-Type` 将相应数据转换会 JS 对象。以便比对。
      c: 7