Skip to content

Conversation

@zokioki
Copy link

@zokioki zokioki commented Dec 25, 2021

This allows ahoy to be configured with an optional beforeSend callback, allowing the user to modify a request before sending if needed. For example:

ahoy.configure({
  beforeSend: (xhr, settings) => {
    // do something with request ...
  }
});

One use case for this is to allow for the setting of custom headers on a per-request basis.

This change allows the user to specify a callback which will fire
before a request is triggered. The function will have access to
the XHR object and settings object.
This ensures the request data being passed to the beforeSend callback
is in the same format for both the ajax and XMLHttpRequest versions.
@zokioki zokioki marked this pull request as ready for review December 25, 2021 22:32
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

Successfully merging this pull request may close these issues.

1 participant