FIX Don't mark mocked response as an error #82
Merged
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.
This response type is only ever returned from the
findgridfield
action on theGridFieldQueuedExportButton
(seeGridFieldQueuedExportButton::handleAction()
). The only way this action is accessed in normal operation is from theGenerateCSVJob::getGridField()
method, which uses a mock request viaDirector::test()
to get the response. More discussion about why this happens is in the parent issue.In other words, the only way this response class is ever used, it cannot be a 500 error. It's always going to be a success - unless some exception is thrown, in which case this response won't be used anyway.
My best guess as to why this was set to
500
is in case some smart-alek decides to manually access thefindgridfield
action by typing in the appropriate URL to do so.... which is both a super weird edge case and also not something that explicitly needs a 500 response. A 200 response is, I'd argue, more appropriate even in that scenario, since the action has done what it's meant to do. There was no error.tl;dr:
500
was probably never correct for this in the first place.Issue