{"id":22511550,"url":"https://github.com/codepunkt/enforce-content-type","last_synced_at":"2025-08-03T14:32:34.829Z","repository":{"id":57225298,"uuid":"56678768","full_name":"codepunkt/enforce-content-type","owner":"codepunkt","description":"Connect/Express middleware to enforce Content-Type headers on request","archived":false,"fork":false,"pushed_at":"2016-05-17T08:51:52.000Z","size":7,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-19T23:42:05.839Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codepunkt.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}},"created_at":"2016-04-20T10:43:30.000Z","updated_at":"2019-03-19T22:46:56.000Z","dependencies_parsed_at":"2022-08-24T10:40:18.378Z","dependency_job_id":null,"html_url":"https://github.com/codepunkt/enforce-content-type","commit_stats":null,"previous_names":["gonsfx/enforce_content_type"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codepunkt%2Fenforce-content-type","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codepunkt%2Fenforce-content-type/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codepunkt%2Fenforce-content-type/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codepunkt%2Fenforce-content-type/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codepunkt","download_url":"https://codeload.github.com/codepunkt/enforce-content-type/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228548560,"owners_count":17935226,"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":[],"created_at":"2024-12-07T02:13:13.439Z","updated_at":"2024-12-07T02:13:13.901Z","avatar_url":"https://github.com/codepunkt.png","language":"JavaScript","readme":"Enforce Content-Type middleware\n===============================\n[![npm version](https://badge.fury.io/js/enforce-content-type.svg)](https://badge.fury.io/js/enforce-content-type)\n[![Build Status](https://travis-ci.org/gonsfx/enforce-content-type.svg?branch=master)](https://travis-ci.org/gonsfx/enforce-content-type)\n[![Coverage Status](https://coveralls.io/repos/github/gonsfx/enforce-content-type/badge.svg?branch=master)](https://coveralls.io/github/gonsfx/enforce-content-type?branch=master)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)\n\nThis middleware enforces the `Content-Type` header of requests to be a specified value.\nIf the header doesn't match that value, a HTTP status code 415 \"Unsupported Media Type\" is returned.\n\n```javascript\nvar enforceContentType = require('enforce-content-type')\n\napp.use(enforceContentType({\n  type: 'application/json'\n}))\n```\n\nIt is also possible to specify multiple acceptable content types:\n\n```javascript\napp.use(enforceContentType({\n  type: [\n    'application/json',\n    'multipart/form-data'\n  ]\n}))\n```\n\nRequests without a body are not enforced unless the `force` option is set to true:\n\n```javascript\napp.use(enforceContentType({\n  force: true,\n  type: 'application/json'\n}))\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodepunkt%2Fenforce-content-type","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodepunkt%2Fenforce-content-type","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodepunkt%2Fenforce-content-type/lists"}