无法使用cURL查看响应消息

时间:2016-07-28 06:30:56

标签: java curl

我正在尝试使用cURL调用API。

使用此URL发送请求时使用Advanced Rest Client(ARC):

http://localhost:8080/jcr/root/myfolder/integrationTestNode

我收到此回复:

Status:
500: Internal Server Error
Loading time: 37 ms
Date: Thu, 28 Jul 2016 06:20:11 GMT
Content-Type: text/plain
Content-Length: 88

消息

Failed to delete filejavax.jcr.PathNotFoundException: /root/myfolder/integrationTestNode

这正是我想要的。

但是当我在shell脚本中使用cURL尝试相同时,我无法看到消息

这是脚本:

url="http://localhost:8080/jcr/root/myfolder/integrationTestNode"
echo ${url}
curl -u amit:pass --verbose -I -X DELETE \
--url "${url}"
echo " ----------------------------------------------------------------------------"

这是剧本的回应:

http://localhost:8080/jcr/root/myfolder/integrationTestNode
* timeout on name lookup is not supported
*   Trying ::1...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*                                                                                                                 Connected to localhost (::1) port 8080 (#0)
* Server auth using Basic with user 'amit'
> DELETE /jcr/root/myfolder/integrationTestNode HTTP/1.1
> Host: localhost:8080
> Authorization: Basic YW1pdDpwYXNz
> User-Agent: curl/7.49.1
> Accept: */*
>
< HTTP/1.1 500 Internal Server Error
< Date: Thu, 28 Jul 2016 06:25:26 GMT
< Content-Type: text/plain
< Content-Length: 88
<
* Excess found in a non pipelined read: excess = 88 url = /jcr/root/myfolder/int                                                                                                                egrationTestNode (zero-length body)
  0    88    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0HT                                                                                                                TP/1.1 500 Internal Server Error
Date: Thu, 28 Jul 2016 06:25:26 GMT
Content-Type: text/plain
Content-Length: 88

如何使用cURL查看响应消息

我正在使用javax.ws.rs.core.Response.status().entity("").build()发送消息。

0 个答案:

没有答案