Casablanca request returns the same response every time

Bloqueado Casablanca request returns the same response every time

  • Wednesday, August 22, 2012 2:07 PM
     
      Has Code

    Hi All,

    I have the following code which executes every time when a user press a button:

    http_client client = http_client(API_URL);
    pplx::task<http::http_response> clientRequest = client.request(methods::GET, L"/do/some/action");
    clientRequest.then([=](http_response  clientResponse) {
        std::wstring responseString = clientResponse.extract_wstring();
        http::json::value clientResults(responseString );
           .....
    });

    "responseString" always  has the same value until I restart the application. I checked my server and it returns different response every time. Does anybody know what is the reason this issue? 

All Replies

  • Wednesday, August 22, 2012 2:21 PM
    Owner
     
     Answered

    Hi,

    Are you doing this on Windows 8 / WinRT? If so, the problem is that the underlying HTTP stack is rather aggressive about caching the responses from GET messages. Make sure your server is sending the right cache-control headers in its responses.

    Niklas

  • Wednesday, August 22, 2012 4:03 PM
     
     
    Thank you!