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

fshows-http

v1.0.7

Published

## 使用

Downloads

1

Readme

fsRequest 请求工具

使用

安装

npm install fshows-http --save

demo

import FsHttp from 'fshows-http'
const fsHttp1 = new FsHttp({
  appid: 'java-test',
  content: '',
  salt: 'xxxxxxx', // 加盐 加密完之后需要从params删除
  version: '1.0.0'
})
// 也可以创建实例后 设置签名参数
const fsHttp2 = new FsHttp()
fsHttp2.setSignParams({
  appid: 'java-test',
  content: '',
  salt: 'yyyyy', // 加盐 加密完之后需要从params删除
  version: '1.0.0'
})

// 自定义成功函数 通用
fsHttp1.customSuccessHandle = (result, reqData, reqOptionst) => {
  console.log('可以在此,上报日志')
}
// 自定义失败函数 通用
fsHttp.customErrorHandle = (result, reqData, reject) => {
  console.log('没事跑个错误')
  reject({
    errorMsg: '自定义抛错'
  })
}

// 请求函数
fsHttp1
  .request({
    data: {
      storeId: 95011991,
      customerId: 'xxxxxxxxx',
      qrcode: '2ecf5e2599804f4788d6b0643e53d53f',
      page: 1,
      pageSize: 8,
      accessToken: 'ea788c04a53049859269cbb1dec5da16',
      templateProgram: 2,
      minaPlatform: 1,
      uid: '3209834'
    },
    url: 'com.fshows.lifecircle.look.around',
    baseUrl: 'https://lifecircle-minagw-test.51youdian.com/mobile/gateway',
    method: 'POST',
    retryTimes: 3,
    hasToast: true
  })
  .then(res => {})
  .catch(err => {})

配置项

  • 签名参数 signParams()

    • appid 应用 ID string 类型
    • content 内容 string 类型
    • salt 盐 string 类型
    • version 版本 string 类型
  • 请求参数 reqOptions

    • baseUrl 基础 url 地址 必传
    • url 接口地址 必传
    • method 请求方式 'POST'|'GET'|undefined 非必传
    • data 请求数据
    • retryTimes 请求次数,当接口异常时自动重新请求 非必传 默认值为 1
    • hasToast 是否有 toast 微信/支付宝小程序环境有效 接口返回值后 若 hasToast 为 true 关闭 toast 弹窗

方法