New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

wl-stations-http

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wl-stations-http

用于 vue3 - vite

latest
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

用于 vue3 - vite

Http 使用方法

注意,目前仅支持 post 和 get 方法

下载

//在控制台输入命令安装
npm i wl-stations-http

使用

// 构建http对象
let http = new Http({
  baseUrl: "", //请求基础路径
  serviceName: " ", //自服务的名称
  rpcUrl: " ", // psc节点的地址,不填则默认为 https://psc-mainnet.polysmartchain.com
  content: " ",
  signature: " ",
});

调用接口

http
  .post(`proposal/pip/proposal`, {
    pageNum: 1,
    pageSize: 10,
  })
  .then((res) => {
    console.log("响应结果", res);
  });

// or

let { data: res } = await http.post(`proposal/pip/proposal`, {
  pageNum: 1,
  pageSize: 10,
});

添加请求或响应拦截器 (可以添加多个)

// 添加请求拦截器
http.addRequestInterceptor((config) => {
  /*
  let config = {
      method: "POST",
      headers: { "Content-Type": "application/json", ...headers },
      body: JSON.stringify(params),
      url: await this.initUrl(path),
    };
  */
  if (config.url.includes("/api/points")) {
    config.baseURL = "https://burnrate.polysmartchain.com";
  }
  if (token) {
    config.headers = {
      authorization: token,
    };
  }
  return config;
});

//响应拦截器 参数同上
// http.addResponseInterceptor(config=>{});

桥接 使用方法

FAQs

Package last updated on 01 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts