Skip to content

Instantly share code, notes, and snippets.

@spacejack
Created March 21, 2017 02:52
Show Gist options
  • Save spacejack/6d3d3b307d66088fa78dcc928088db4e to your computer and use it in GitHub Desktop.
Save spacejack/6d3d3b307d66088fa78dcc928088db4e to your computer and use it in GitHub Desktop.

deserialize

A deserialization method to be applied to the xhr.responseText. Defaults to a small wrapper around JSON.parse that returns null for empty responses. If extract is defined, deserialize will be skipped.

extract

A hook to specify how the XMLHttpRequest response should be read. Useful for processing response data, reading headers and cookies. By default this is a function that returns xhr.responseText, which is in turn passed to deserialize. If a custom extract callback is provided, the xhr parameter is the XMLHttpRequest instance used for the request, and options is the object that was passed to the m.request call. Additionally, deserialize will be skipped and the value returned from the extract callback will not automatically be parsed as JSON.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment