By defining a Meteor method, I can return a JSON Object as such:
Meteor.method("returnJsonObject", function() {
return { "test" : "this is a test" }
});
If I send a GET request to http://localhost:3000/methods/returnJsonObject, this returns plain text just as I expect.
If I want a browser to be redirected here and automatically download this text as a file, such as "download.json", then I need to be able to update the response headers to indicate this is a file.
Is it possible to access the response headers in order to serve a file like this? I checked the unit tests and couldn't find an example...
By defining a Meteor method, I can return a JSON Object as such:
If I send a
GET
request tohttp://localhost:3000/methods/returnJsonObject
, this returns plain text just as I expect.If I want a browser to be redirected here and automatically download this text as a file, such as "download.json", then I need to be able to update the response headers to indicate this is a file.
Is it possible to access the response headers in order to serve a file like this? I checked the unit tests and couldn't find an example...