{"action":"created","issue":{"url":"https://api.github.com/repos/SaturnFramework/Saturn/issues/39","repository_url":"https://api.github.com/repos/SaturnFramework/Saturn","labels_url":"https://api.github.com/repos/SaturnFramework/Saturn/issues/39/labels{/name}","comments_url":"https://api.github.com/repos/SaturnFramework/Saturn/issues/39/comments","events_url":"https://api.github.com/repos/SaturnFramework/Saturn/issues/39/events","html_url":"https://github.com/SaturnFramework/Saturn/issues/39","id":308263257,"number":39,"title":"not_found_handler doesn't seem to respect forward.","user":{"login":"isaacabraham","id":1781813,"avatar_url":"https://avatars2.githubusercontent.com/u/1781813?v=4","gravatar_id":"","url":"https://api.github.com/users/isaacabraham","html_url":"https://github.com/isaacabraham","followers_url":"https://api.github.com/users/isaacabraham/followers","following_url":"https://api.github.com/users/isaacabraham/following{/other_user}","gists_url":"https://api.github.com/users/isaacabraham/gists{/gist_id}","starred_url":"https://api.github.com/users/isaacabraham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isaacabraham/subscriptions","organizations_url":"https://api.github.com/users/isaacabraham/orgs","repos_url":"https://api.github.com/users/isaacabraham/repos","events_url":"https://api.github.com/users/isaacabraham/events{/privacy}","received_events_url":"https://api.github.com/users/isaacabraham/received_events","type":"User","site_admin":false},"labels":[{"id":786618247,"url":"https://api.github.com/repos/SaturnFramework/Saturn/labels/bug","name":"bug","color":"ee0701","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-24T13:40:11Z","updated_at":"2018-05-02T12:53:21Z","closed_at":null,"author_association":"COLLABORATOR","body":"We have two simple routers set up:\r\n\r\n```fsharp\r\nlet router = scope {\r\n    forward \"/api\" ApiRouter.apiRouter\r\n    forward \"\" ViewRouter.browserRouter\r\n}\r\n```\r\nInside `browserRouter` we have defined a `not_found_handler`\r\n\r\n```fsharp\r\nnot_found_handler (htmlView NotFound.layout) //Use the default 404 webpage\r\n```\r\n\r\nHowever, this seems to *also* apply to missing `/api` routes. I want non-existant api routes to have a different behaviour i.e. to return a 404 instead of the HTML view we set above, which should only apply to browser routes (and returns a 200 with some HTML)."},"comment":{"url":"https://api.github.com/repos/SaturnFramework/Saturn/issues/comments/385967320","html_url":"https://github.com/SaturnFramework/Saturn/issues/39#issuecomment-385967320","issue_url":"https://api.github.com/repos/SaturnFramework/Saturn/issues/39","id":385967320,"user":{"login":"mexx","id":378088,"avatar_url":"https://avatars0.githubusercontent.com/u/378088?v=4","gravatar_id":"","url":"https://api.github.com/users/mexx","html_url":"https://github.com/mexx","followers_url":"https://api.github.com/users/mexx/followers","following_url":"https://api.github.com/users/mexx/following{/other_user}","gists_url":"https://api.github.com/users/mexx/gists{/gist_id}","starred_url":"https://api.github.com/users/mexx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mexx/subscriptions","organizations_url":"https://api.github.com/users/mexx/orgs","repos_url":"https://api.github.com/users/mexx/repos","events_url":"https://api.github.com/users/mexx/events{/privacy}","received_events_url":"https://api.github.com/users/mexx/received_events","type":"User","site_admin":false},"created_at":"2018-05-02T12:53:21Z","updated_at":"2018-05-02T12:53:21Z","author_association":"CONTRIBUTOR","body":"IMO it's not a bug.\r\nThe definition of `forward` is pass any request that starts with given string to the given router. When the router wasn't able to handle the request, forward doesn't fail the execution. The pipeline proceeds with the next element, in this case `forward \"\"`, what actually means every yet unhandled request.\r\n\r\nTo achieve the desired behaviour, you should define a specific `not_found_handler` inside the `apiRouter`. This would react on all unhandled requests with `/api` routes as only those get forwarded to this router."}}
{"actor":{"display_login":"mexx"}}