{"id":23651485,"url":"https://github.com/athanclark/wai-middleware-content-type","last_synced_at":"2025-11-15T17:30:16.770Z","repository":{"id":56882291,"uuid":"42961121","full_name":"athanclark/wai-middleware-content-type","owner":"athanclark","description":"Route to different middlewares based on the incoming Accept header detected.","archived":false,"fork":false,"pushed_at":"2023-09-28T09:25:02.000Z","size":86,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-28T17:44:34.041Z","etag":null,"topics":["haskell","haskell-warp","http-server","middleware","mime-types"],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/athanclark.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2015-09-22T21:12:56.000Z","updated_at":"2023-09-28T09:25:06.000Z","dependencies_parsed_at":"2024-02-26T01:33:25.905Z","dependency_job_id":"e88e32d7-341b-4469-b2d2-f5cb9b9ead11","html_url":"https://github.com/athanclark/wai-middleware-content-type","commit_stats":{"total_commits":60,"total_committers":3,"mean_commits":20.0,"dds":0.06666666666666665,"last_synced_commit":"6de3d7a1f5cbbf6ee8c8a582499731f024c9ebb3"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/athanclark%2Fwai-middleware-content-type","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/athanclark%2Fwai-middleware-content-type/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/athanclark%2Fwai-middleware-content-type/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/athanclark%2Fwai-middleware-content-type/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/athanclark","download_url":"https://codeload.github.com/athanclark/wai-middleware-content-type/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239609709,"owners_count":19668000,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["haskell","haskell-warp","http-server","middleware","mime-types"],"created_at":"2024-12-28T16:37:55.587Z","updated_at":"2025-11-15T17:30:16.706Z","avatar_url":"https://github.com/athanclark.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"wai-middleware-content-type\n===========================\n\nRoute middlewares based on the incoming `Accept` HTTP header,\nand other hints like the file extension (`foo.txt`) of the route\nrequested.\n\n## Usage\n\nThis package provides many combinators for turning various data\ntypes into the response you'd expect. For instance,\n[blaze-html](https://hackage.haskell.org/package/blaze-html) gives\nus _strictly_ `Html` data, right? We can be sure to only respond\nwith `Html`-compatible requests with our toolset:\n\n```haskell\nimport Network.Wai.Middleware.ContentType\nimport Network.Wai.Trans\n\n\nmyMiddleware :: MiddlewareT (ReaderT Env m)\n\ncontentTypeRoutes :: Monad m =\u003e\n                     FileExtListenerT urlbase (Status -\u003e ResponseHeaders -\u003e Response) m ()\ncontentTypeRoutes = do\n  blaze myBlazeResponse\n  cassius myCassiusResponse\n  text myTextResponse\n\n\ncontentMiddleware :: Monad m =\u003e MiddlewareT m\ncontentMiddleware app req respond =\n  fileExtsToMiddleware $\n    mapResponse (\\f -\u003e f status200 []) contentTypeRoutes\n```\n\n\nThis library was designed for use with [nested-routes](https://hackage.haskell.org/package/nested-routes),\nbut it's all good if you want to use it separately.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fathanclark%2Fwai-middleware-content-type","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fathanclark%2Fwai-middleware-content-type","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fathanclark%2Fwai-middleware-content-type/lists"}