{"action":"created","issue":{"url":"https://api.github.com/repos/MithrilJS/mithril.js/issues/1858","repository_url":"https://api.github.com/repos/MithrilJS/mithril.js","labels_url":"https://api.github.com/repos/MithrilJS/mithril.js/issues/1858/labels{/name}","comments_url":"https://api.github.com/repos/MithrilJS/mithril.js/issues/1858/comments","events_url":"https://api.github.com/repos/MithrilJS/mithril.js/issues/1858/events","html_url":"https://github.com/MithrilJS/mithril.js/issues/1858","id":231035881,"number":1858,"title":"X-CSRF-TOKEN","user":{"login":"Lafriakh","id":3150015,"avatar_url":"https://avatars1.githubusercontent.com/u/3150015?v=3","gravatar_id":"","url":"https://api.github.com/users/Lafriakh","html_url":"https://github.com/Lafriakh","followers_url":"https://api.github.com/users/Lafriakh/followers","following_url":"https://api.github.com/users/Lafriakh/following{/other_user}","gists_url":"https://api.github.com/users/Lafriakh/gists{/gist_id}","starred_url":"https://api.github.com/users/Lafriakh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lafriakh/subscriptions","organizations_url":"https://api.github.com/users/Lafriakh/orgs","repos_url":"https://api.github.com/users/Lafriakh/repos","events_url":"https://api.github.com/users/Lafriakh/events{/privacy}","received_events_url":"https://api.github.com/users/Lafriakh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-05-24T13:15:18Z","updated_at":"2017-05-24T13:27:08Z","closed_at":null,"body":"is there any way to add X-CSRF-TOKEN header globally.\r\nWithout add it to every request."},"comment":{"url":"https://api.github.com/repos/MithrilJS/mithril.js/issues/comments/303723096","html_url":"https://github.com/MithrilJS/mithril.js/issues/1858#issuecomment-303723096","issue_url":"https://api.github.com/repos/MithrilJS/mithril.js/issues/1858","id":303723096,"user":{"login":"nordfjord","id":3721521,"avatar_url":"https://avatars0.githubusercontent.com/u/3721521?v=3","gravatar_id":"","url":"https://api.github.com/users/nordfjord","html_url":"https://github.com/nordfjord","followers_url":"https://api.github.com/users/nordfjord/followers","following_url":"https://api.github.com/users/nordfjord/following{/other_user}","gists_url":"https://api.github.com/users/nordfjord/gists{/gist_id}","starred_url":"https://api.github.com/users/nordfjord/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nordfjord/subscriptions","organizations_url":"https://api.github.com/users/nordfjord/orgs","repos_url":"https://api.github.com/users/nordfjord/repos","events_url":"https://api.github.com/users/nordfjord/events{/privacy}","received_events_url":"https://api.github.com/users/nordfjord/received_events","type":"User","site_admin":false},"created_at":"2017-05-24T13:27:08Z","updated_at":"2017-05-24T13:27:08Z","body":"sure... just create a new function\r\n\r\n```\r\nconst headers = ()=> ({headers: {'X-CSRF-TOKEN': 'whatever'}});\r\nconst request = (...args)=>\r\n  args.length > 1 || typeof args[0] === 'string'\r\n    ? m.request(args[0], Object.assign(headers(), args[1] || {}))\r\n    : m.request(Object.assign(headers(), args[0] || {}));\r\n```\r\n\r\nThen just use that in stead of m.request\r\n\r\nAlternatively you can monkeypatch m.request with something like the above function. "}}
{"actor":{"display_login":"nordfjord"}}