Parse error message for non-OK status codes.
This commit is contained in:
parent
0ca763054c
commit
73c6c11985
@ -54,7 +54,7 @@ func (client *SOAPClient) PerformAction(actionNamespace, actionName string, inAc
|
|||||||
return fmt.Errorf("goupnp: error performing SOAP HTTP request: %v", err)
|
return fmt.Errorf("goupnp: error performing SOAP HTTP request: %v", err)
|
||||||
}
|
}
|
||||||
defer response.Body.Close()
|
defer response.Body.Close()
|
||||||
if response.StatusCode != 200 {
|
if response.StatusCode != 200 && response.ContentLength == 0 {
|
||||||
return fmt.Errorf("goupnp: SOAP request got HTTP %s", response.Status)
|
return fmt.Errorf("goupnp: SOAP request got HTTP %s", response.Status)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,6 +66,8 @@ func (client *SOAPClient) PerformAction(actionNamespace, actionName string, inAc
|
|||||||
|
|
||||||
if responseEnv.Body.Fault != nil {
|
if responseEnv.Body.Fault != nil {
|
||||||
return responseEnv.Body.Fault
|
return responseEnv.Body.Fault
|
||||||
|
} else if response.StatusCode != 200 {
|
||||||
|
return fmt.Errorf("goupnp: SOAP request got HTTP %s", response.Status)
|
||||||
}
|
}
|
||||||
|
|
||||||
if outAction != nil {
|
if outAction != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user