I'm using GCDWebServer
's addDefaultHandlerForMethod:@"GET"
and sending an NSData response via
GCDWebServerDataResponse responseWithData:contentType:@"application/octet-stream"
The user's browser receives a file which it saves in the Download folder. So far, so good. I also want to send a GCDWebServerDataResponse responseWithHTML:
to show additional information to the user.
Given one GET request, is there a way to send two responses, one with data and one with HTML?
This is not possible due to the way HTTP is designed to work: 1 request = 1 response. If you want an HTML page and also a file to be downloaded, return a first response for the HTML page, then from this page itself, using JavaScript or a redirect, now do the download.