Skip to content

Commit 5ad8de0

Browse files
committed
Merge pull request #79 from carlbennettnz/loosen-media-type-restriction
Remove media type check
2 parents ad76b46 + 76ad99c commit 5ad8de0

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/steps/http/content-negotiation/validate-content-type.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import {objectIsEmpty} from "../../../util/type-handling";
66
export default function validateContentType(requestContext, supportedExt) {
77
return Q.Promise(function(resolve, reject) {
88
let contentType = contentTypeParser.parse(requestContext.contentType);
9+
10+
// Removed due to issues with Firefox automatically adding charset parameter
11+
// See: https://github.com/ethanresnick/json-api/issues/78
12+
delete contentType.parameters.charset;
913

1014
// In the future, we might delegate back to the framework if the client
1115
// provides a base content type other than json-api's. But, for now, we 415.

test/integration/content-negotiation/index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,19 @@ AgentPromise.then((Agent) => {
2323
}).catch(done);
2424
});
2525

26+
// Spec ignored due to issues with Firefox automatically adding charset parameter
27+
// See: https://github.com/ethanresnick/json-api/issues/78
28+
it("must accept charset parameter", (done) => {
29+
Agent.request("POST", "/organizations")
30+
.type("application/vnd.api+json;charset=utf-8")
31+
.send({"data": VALID_ORG_RESOURCE_NO_ID})
32+
.promise()
33+
.then((res) => {
34+
expect(res.status).to.equal(201);
35+
done();
36+
}, done).catch(done);
37+
});
38+
2639
// "Servers MUST send all JSON API data in response documents with the
2740
// header Content-Type: application/vnd.api+json without any media type
2841
// parameters."

0 commit comments

Comments
 (0)