我有一个对 Java 服务的 REST 调用,它对路径进行 POST
localhost:8080/api/xyz
并返回响应。响应当然有 response.header['location'] 具有正确的位置和 ID
'xyz/{id}'
对于该方法中的进一步步骤,我只需要从“位置”中提取“id”部分。现在这就是我正在做的,
(response.header['location'].split('/'))[1]
有没有更好的方法来解决这个问题?
我有一个对 Java 服务的 REST 调用,它对路径进行 POST
localhost:8080/api/xyz
并返回响应。响应当然有 response.header['location'] 具有正确的位置和 ID
'xyz/{id}'
对于该方法中的进一步步骤,我只需要从“位置”中提取“id”部分。现在这就是我正在做的,
(response.header['location'].split('/'))[1]
有没有更好的方法来解决这个问题?