batch http requests

后端 未结 7 1899
[愿得一人]
[愿得一人] 2021-02-01 06:31

Does anyone know a standard way to batch http requests? Meaning - sending multiple http atomic requests in one round trip?

We need such mechanism in our REST API implem

7条回答
  •  隐瞒了意图╮
    2021-02-01 07:12

    CURL

    The build 17063 of windows 10 (and the following versions) are coming with CURL command:

    curl -X POST -H "Content-Type: application/json" -d "{\"name\": \"myname\", \"email\": \"some@example.com\"}' https://example/contact
    

    winHttpJs.bat

    call winhttpjs.bat "http://requestb.in/xxxxxx" -method POST -header hdrs.txt -reportfile reportfile2.txt
    
    call winhttpjs.bat "http://requestb.in/xxxxxx" -method GET -header hdrs.txt -reportfile reportfile3.txt -saveTo c:\somezip.zip 
    
    call winhttpjs.bat "http://requestb.in/xxxxxx" -method POST -header hdrs.txt -reportfile reportfile2.txt -saveTo responsefile2 -ua "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36"  -body-file some.json
    

    It does not support multi-part requests at the moment ,i'm planning to add such a thing but I don't know when i'll have the time.

提交回复
热议问题