Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
ip7x12v5
V2EX  ›  Linux

Postman 这个工具可以在 centos 下面使用命令行执行测试吗?

  •  
  •   ip7x12v5 · Jan 3, 2018 · 5645 views
    This topic created in 3102 days ago, the information mentioned may be changed or developed.

    最近在测试数据,使用 POSTMAN 在 win 下面还挺好用的,Centos 下不知道能不能用,因为我的 Centos 是命令行没有图形界面,不知能否使用,或者有没有什么能在命令行下模拟 post 请求的工具。

    12 replies    2018-01-03 11:16:13 +08:00
    hujnnn
        1
    hujnnn  
       Jan 3, 2018 via iPhone
    postman 可以自动把请求参数转成各种编程语言的 HTTP 请求,包括 shell 命令
    luoqeng
        2
    luoqeng  
       Jan 3, 2018
    curl
    XueSeason
        3
    XueSeason  
       Jan 3, 2018   ❤️ 1
    newman?
    nicevar
        4
    nicevar  
       Jan 3, 2018
    直接用 curl
    thecon
        5
    thecon  
       Jan 3, 2018
    命令行就用 httpie 呗
    cha1
        6
    cha1  
       Jan 3, 2018   ❤️ 1
    HTTPie 比 curl 友好。


    几个简单的例子:
    ```
    $ http -v GET example.org
    GET / HTTP/1.1
    Accept: */*
    Accept-Encoding: gzip, deflate
    Connection: keep-alive
    Host: example.org
    User-Agent: HTTPie/0.9.9

    $ http -v --form PUT example.org param1=value1 param2=value2
    PUT / HTTP/1.1
    Accept: */*
    Accept-Encoding: gzip, deflate
    Connection: keep-alive
    Content-Length: 27
    Content-Type: application/x-www-form-urlencoded; charset=utf-8
    Host: example.org
    User-Agent: HTTPie/0.9.9

    param1=value1&param2=value2

    $ http -v PUT example.org param1=value1 param2=value2
    PUT / HTTP/1.1
    Accept: application/json, */*
    Accept-Encoding: gzip, deflate
    Connection: keep-alive
    Content-Length: 40
    Content-Type: application/json
    Host: example.org
    User-Agent: HTTPie/0.9.9

    {
    "param1": "value1",
    "param2": "value2"
    }

    $ http -v PUT example.org User-Agent:Postman param1=value1 param2=value2
    PUT / HTTP/1.1
    Accept: application/json, */*
    Accept-Encoding: gzip, deflate
    Connection: keep-alive
    Content-Length: 40
    Content-Type: application/json
    Host: example.org
    User-Agent: Postman

    {
    "param1": "value1",
    "param2": "value2"
    }
    ```

    HTTPie 的官网:
    https://httpie.org/
    prolic
        7
    prolic  
       Jan 3, 2018
    postman 能直接生成 curl,其实感觉用 ipython 发 requests 更方便点
    checgg
        8
    checgg  
       Jan 3, 2018
    curl + 1
    我一般请求都会通过 curl。
    postman 很少用。
    curl + jq . 简直不要太爽。
    ip7x12v5
        9
    ip7x12v5  
    OP
       Jan 3, 2018
    @checgg 谢谢!学习了!
    ip7x12v5
        10
    ip7x12v5  
    OP
       Jan 3, 2018
    @prolic 谢谢!学习了!
    ip7x12v5
        11
    ip7x12v5  
    OP
       Jan 3, 2018
    @zqhong 感谢!感谢!
    Tink
        12
    Tink  
       Jan 3, 2018 via iPhone
    httpie
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3309 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 115ms · UTC 11:58 · PVG 19:58 · LAX 04:58 · JFK 07:58
    ♥ Do have faith in what you're doing.