pokeb/asi-http-request — Issue #280: responseStatusMessage property could return wrong value when using cache
Author: akisute
Created: 2011-10-31 10:57:19+00:00
State: open

The responseStatusMessage property ASIHTTPRequest could return wrong value when its response is returned by the download cache. Here's how to reproduce:

```objective-c
ASIHTTPRequest *firstRequest = [ASIHTTPRequest requestWithURL:url_to_some_server_which_returns_200_result_with_max_age
usingCache:[ASIDownloadCache sharedCache]
andCachePolicy:ASIAskServerIfModifiedCachePolicy]; // should be this policy in order to always load from the target server
[firstRequest startSynchronous];

// Change some settings of the target server to return a response of non-200 status
// Assume you've made your server returns 503

ASIHTTPRequest *secondRequest = [ASIHTTPRequest requestWithURL:url_to_some_server_which_returns_200_result_with_max_age
usingCache:[ASIDownloadCache sharedCache]
andCachePolicy:ASIAskServerIfModifiedCachePolicy]; // should be this policy in order to always load from the target server
[secondRequest startSynchronous];

[secondRequest responseStatusCode]; // 200, as expected, because the response is made from the cache created by firstRequest
[secondRequest responseStatusMessage]; // 503 Service Unavailable is returned
```

This is simply because ASIDownloadCache does not store the response status message (response status code is stored as an custom HTTP header value).

This is somewhat confusing to me, although this issue might be too trivial to compensate for the labor of fix.