Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gohttp

Package Overview
Dependencies
Maintainers
1
Versions
125
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gohttp

http client for HTTP/1.1

  • 3.0.1
  • npm
  • Socket score

Version published
Weekly downloads
150
increased by733.33%
Maintainers
1
Weekly downloads
 
Created
Source

gohttp

针对HTTP/1.1封装的客户端请求库。

基于Promise实现,可以通过then接收返回结果,或者配合async/await使用。

安装

npm i gohttp

GET请求


const gohttp = require('gohttp');

gohttp.get('http://localhost:2020/')
.then(data => {
    console.log(data);
}, err => {
    console.log(err);
});

POST请求


const gohttp = require('gohttp');

gohttp.post('http://localhost:2020/p', {
    body : {
        user: 'wang'
    }
})
.then(data => {
    console.log(data);
}, err => {
    console.log(err);
});

上传文件


const gohttp = require('gohttp');

gohttp.upload('http://localhost:2020/upload', {
    files: {
        image: [
            'pictures/a.jpg',
            'pictures/b.png'
        ],
        video: [
            'videos/a.mp4',
            'videos/b.mp4'
        ]
    }
})
.then(data => {
    console.log(data);
}, err => {
    console.log(err);
});

Keywords

FAQs

Package last updated on 29 Apr 2020

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc