Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not cache response if expected JSON data is corrupted #50

Open
RadoslawZambrowski opened this issue Aug 31, 2023 · 0 comments
Open

Comments

@RadoslawZambrowski
Copy link
Contributor

This is a Feature Proposal

Description

HttpResponseCreator._parseUrlEventContent function returns {} when ParseJSON is invalid. It may lead to caching invalid responses. At this point, the app knows that the response body is a non-empty string and JSON format is expected. Thus failed JSON parsing suggests that body is corrupted, and caching it may lead to unexpected behavior.

prototype._parseUrlEventContent = function (urlEvent as Object) as Object
  if (NOT m._isJsonResponse(urlEvent)) then return {}

  content = urlEvent.getString()
  if (content = "") then return {}

  data = ParseJSON(content)
  if (data = Invalid) then return {}

  return data
end function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant