Teheran

command module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

README

Teheran

Teheran是一个简单的HTTP库,能让请求rest api更加简洁。body入参格式只支持json,其他场景还是建议使用Go标准库http。

image

Installation

Install Teheran using the "go get" command:

go get github.com/FastSchnell/Teheran/requests

Usage

import "Teheran/requests"

func testReq() {
    body := map[string]interface{}{"11": "22"}
    resp, err := requests.Post("http://112.74.200.115", requests.WithJson(body))
    if err != nil {
        fmt.Println(err.Error())
    }

    if resp.StatusCode == 404 {
        json, err := resp.Json()
        if err != nil {
            fmt.Println("json err", err.Error())
        }

        for k, v := range json {
            fmt.println(k, v)
        }
    }
}

License

Teheran is available under the Apache License, Version 2.0.

项目故事

为了纪念最痛苦的一次离职经历,2019.01.31-2019.02.28。个人称之为"逃离德黑兰"计划。

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL