[mod_httapi] Update cache file if the extension changes #825
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If a HTTP request changes the extension (by using Content-Type header) of the existing cached file,
remove the existing cached file, and allow the new one to save with the correct extension.
I have an HTTP endpoint that can update the response between requests to it. We use this by sending the codec of the call in the URL, and converting the file in the background for the next call.
I've setup an example endpoint that returns a mp3 or wav at random, and tested this by calling playback with the URL:
Before
Gets wav first, then the mp3
After
Gets wav first, then mp3