{"action":"created","issue":{"url":"https://api.github.com/repos/digidem/openrosa-request-middleware/issues/2","labels_url":"https://api.github.com/repos/digidem/openrosa-request-middleware/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/digidem/openrosa-request-middleware/issues/2/comments","events_url":"https://api.github.com/repos/digidem/openrosa-request-middleware/issues/2/events","html_url":"https://github.com/digidem/openrosa-request-middleware/issues/2","id":128023416,"number":2,"title":"node-mocks-http tests for potential pull request","user":{"login":"hallahan","id":556367,"avatar_url":"https://avatars.githubusercontent.com/u/556367?v=3","gravatar_id":"","url":"https://api.github.com/users/hallahan","html_url":"https://github.com/hallahan","followers_url":"https://api.github.com/users/hallahan/followers","following_url":"https://api.github.com/users/hallahan/following{/other_user}","gists_url":"https://api.github.com/users/hallahan/gists{/gist_id}","starred_url":"https://api.github.com/users/hallahan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hallahan/subscriptions","organizations_url":"https://api.github.com/users/hallahan/orgs","repos_url":"https://api.github.com/users/hallahan/repos","events_url":"https://api.github.com/users/hallahan/events{/privacy}","received_events_url":"https://api.github.com/users/hallahan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-21T21:28:35Z","updated_at":"2016-01-26T22:09:24Z","closed_at":null,"body":"I had to modify this middleware, because ODK Collect actually goes into legacy mode without the Location header being added in responses. Also, I don't see any reason why requests without certain headers should be rejected?\r\n\r\nhttps://github.com/hallahan/openrosa-request-middleware/blob/ffa00d6b8caf4aa996006124cb8d9164598e1c92/index.js\r\n\r\nI'm not sure how to write tape tests with this, however, because the mock http object doesn't have `req.connection` or `req.headers.host` like what I usually find in an Express req object."},"comment":{"url":"https://api.github.com/repos/digidem/openrosa-request-middleware/issues/comments/175256196","html_url":"https://github.com/digidem/openrosa-request-middleware/issues/2#issuecomment-175256196","issue_url":"https://api.github.com/repos/digidem/openrosa-request-middleware/issues/2","id":175256196,"user":{"login":"gmaclennan","id":290457,"avatar_url":"https://avatars.githubusercontent.com/u/290457?v=3","gravatar_id":"","url":"https://api.github.com/users/gmaclennan","html_url":"https://github.com/gmaclennan","followers_url":"https://api.github.com/users/gmaclennan/followers","following_url":"https://api.github.com/users/gmaclennan/following{/other_user}","gists_url":"https://api.github.com/users/gmaclennan/gists{/gist_id}","starred_url":"https://api.github.com/users/gmaclennan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gmaclennan/subscriptions","organizations_url":"https://api.github.com/users/gmaclennan/orgs","repos_url":"https://api.github.com/users/gmaclennan/repos","events_url":"https://api.github.com/users/gmaclennan/events{/privacy}","received_events_url":"https://api.github.com/users/gmaclennan/received_events","type":"User","site_admin":false},"created_at":"2016-01-26T22:09:23Z","updated_at":"2016-01-26T22:09:23Z","body":"Hi Nick, I've been investigating this. Do you have more details about when and why this is happening? I found the relevant code in ODK Collect: https://github.com/opendatakit/collect/blob/2500b78ccf781a111cc5067bc166fd6a740c4c01/collect_app/src/main/java/org/odk/collect/android/tasks/InstanceUploaderTask.java#L146-L182\r\n\r\nI think this is related to either the http --> https redirect, or to the `201` status code returned when a form is successfully submitted. Are you using a http (unencrypted) end point?\r\n\r\nI think this does not belong in `openrosa-request-middleware` - this header should only be set on routes with a redirect see https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html, and this middleware is for all end points. It either belongs in [`openrosa-form-submission-middleware`](https://github.com/digidem/openrosa-form-submission-middleware) if related to the `201` response or if it is auth related this maybe should be implementation specific?"}}