Skip to content

Instantly share code, notes, and snippets.

@shinypb
Created April 7, 2011 01:14
Show Gist options
  • Select an option

  • Save shinypb/906862 to your computer and use it in GitHub Desktop.

Select an option

Save shinypb/906862 to your computer and use it in GitHub Desktop.
Hi, Dan;
Patrick and I were discussing how to resolve today's incident, which stemmed from the fact that anything with a ".js" file extension is served from Apache, not Rails, in production. We've got an end point that returns a dynamic provide statement with a bunch of exported data. Looking at it, it's really just a vessel for that exported data.
How would you feel about extending Loadrunner to automatically export requests to JSON endpoints?
Here's (roughly) what we have now:
In the HTML of the page, we include the data file like this:
using('/account/bootstrap_data.js');
And then the route at /account/bootstrap_data.js returns this:
provide('>bootstrap_data', function() {
exports({
foo: 'bar',
baz: 'bop'
});
});
What I'm proposing would be that we have this in the HTML of the page:
using('/account/bootstrap_data.json');
That route would just return a JSON object. Loadrunner would automatically infer this provide statement:
provide('>/account/bootstrap_data', function() {
exports(<decoded JSON from /account/bootstrap_data.json>);
});
Does that make sense? Does it seem like a reasonable addition to you?
— Mark
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment