how to get curl to output only http response body (json) and no other headers etc

前端 未结 2 743
执念已碎
执念已碎 2021-01-31 01:12

I am using curl in a bash script to fetch the response of a service as below,

response=$(curl -isb -H \"Accept: application/json\" \"http://host:8080/some/resour         


        
2条回答
  •  猫巷女王i
    2021-01-31 01:35

    #!/bin/bash
    
    req=$(curl -s -X GET http://host:8080/some/resource -H "Accept: application/json") 2>&1
    echo "${req}"
    

提交回复
热议问题