{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/relay/issues/1385","repository_url":"https://api.github.com/repos/facebook/relay","labels_url":"https://api.github.com/repos/facebook/relay/issues/1385/labels{/name}","comments_url":"https://api.github.com/repos/facebook/relay/issues/1385/comments","events_url":"https://api.github.com/repos/facebook/relay/issues/1385/events","html_url":"https://github.com/facebook/relay/issues/1385","id":176791268,"number":1385,"title":"Allow DefaultNetworkLayer to use simple CORS?","user":{"login":"jakepusateri","id":2494130,"avatar_url":"https://avatars.githubusercontent.com/u/2494130?v=3","gravatar_id":"","url":"https://api.github.com/users/jakepusateri","html_url":"https://github.com/jakepusateri","followers_url":"https://api.github.com/users/jakepusateri/followers","following_url":"https://api.github.com/users/jakepusateri/following{/other_user}","gists_url":"https://api.github.com/users/jakepusateri/gists{/gist_id}","starred_url":"https://api.github.com/users/jakepusateri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakepusateri/subscriptions","organizations_url":"https://api.github.com/users/jakepusateri/orgs","repos_url":"https://api.github.com/users/jakepusateri/repos","events_url":"https://api.github.com/users/jakepusateri/events{/privacy}","received_events_url":"https://api.github.com/users/jakepusateri/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-09-14T01:22:37Z","updated_at":"2016-10-13T16:18:01Z","closed_at":null,"body":"It would be nice to allow DefaultNetworkLayer to use simple CORS so no pre-flight OPTIONS request is required when the GraphQL server is not on the same domain. (graphql.example.com vs www.example.com/graphql). However, the use of \r\n\r\n    content-type:application/json\r\n\r\nmake the request unable to use simple cors.\r\n\r\nhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS\r\n```\r\nThe only allowed values for the Content-Type header are:\r\n    application/x-www-form-urlencoded\r\n    multipart/form-data\r\n    text/plain\r\n```\r\n\r\n'text/plain' is arguably the least wrong of the options. \r\nI tried to set the content-type header myself \r\n\r\n    const networkLayer = new Relay.DefaultNetworkLayer(server, { headers: { 'Content-Type': 'text/plain' }});\r\n\r\nbut that appears to be explicitly blocked: https://github.com/facebook/relay/blob/dcc97a431af719b71b62506ce8fe29b85158ef3e/src/network-layer/default/__tests__/RelayDefaultNetworkLayer-test.js#L58\r\n\r\nWhy can that header not be set? Is there another way to make sure the request is simple CORS?"},"comment":{"url":"https://api.github.com/repos/facebook/relay/issues/comments/253562529","html_url":"https://github.com/facebook/relay/issues/1385#issuecomment-253562529","issue_url":"https://api.github.com/repos/facebook/relay/issues/1385","id":253562529,"user":{"login":"josephsavona","id":6425824,"avatar_url":"https://avatars.githubusercontent.com/u/6425824?v=3","gravatar_id":"","url":"https://api.github.com/users/josephsavona","html_url":"https://github.com/josephsavona","followers_url":"https://api.github.com/users/josephsavona/followers","following_url":"https://api.github.com/users/josephsavona/following{/other_user}","gists_url":"https://api.github.com/users/josephsavona/gists{/gist_id}","starred_url":"https://api.github.com/users/josephsavona/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josephsavona/subscriptions","organizations_url":"https://api.github.com/users/josephsavona/orgs","repos_url":"https://api.github.com/users/josephsavona/repos","events_url":"https://api.github.com/users/josephsavona/events{/privacy}","received_events_url":"https://api.github.com/users/josephsavona/received_events","type":"User","site_admin":false},"created_at":"2016-10-13T16:18:01Z","updated_at":"2016-10-13T16:18:01Z","body":"As a workaround, I would recommend implementing your own network layer. "}}
{"actor":{"display_login":"josephsavona"}}