Merge pull request #695 from allthesignals/add-vnd-api-json-content-type

Add application/vnd.api+json
This commit is contained in:
Liyas Thomas
2020-03-21 08:08:29 +05:30
committed by GitHub

View File

@@ -1439,6 +1439,7 @@ export default {
const getDefaultParams = contentType => { const getDefaultParams = contentType => {
switch (contentType) { switch (contentType) {
case "application/json": case "application/json":
case "application/vnd.api+json":
case "application/hal+json": case "application/hal+json":
return "{}" return "{}"
case "application/xml": case "application/xml":
@@ -1463,7 +1464,8 @@ export default {
} else { } else {
if ( if (
this.responseType === "application/json" || this.responseType === "application/json" ||
this.responseType === "application/hal+json" this.responseType === "application/hal+json" ||
this.responseType === "application/vnd.api+json"
) { ) {
this.responseBodyText = JSON.stringify(this.response.body, null, 2) this.responseBodyText = JSON.stringify(this.response.body, null, 2)
this.responseBodyType = "json" this.responseBodyType = "json"
@@ -1531,12 +1533,13 @@ export default {
* These are content types that can be automatically * These are content types that can be automatically
* serialized by postwoman. * serialized by postwoman.
*/ */
knownContentTypes: () => ["application/json", "application/x-www-form-urlencoded"], knownContentTypes: () => ["application/json", "application/x-www-form-urlencoded", "application/vnd.api+json"],
/** /**
* These are a list of Content Types known to Postwoman. * These are a list of Content Types known to Postwoman.
*/ */
validContentTypes: () => [ validContentTypes: () => [
"application/json", "application/json",
"application/vnd.api+json",
"application/hal+json", "application/hal+json",
"application/xml", "application/xml",
"application/x-www-form-urlencoded", "application/x-www-form-urlencoded",
@@ -1547,6 +1550,7 @@ export default {
return [ return [
"application/json", "application/json",
"application/hal+json", "application/hal+json",
"application/vnd.api+json",
"application/x-www-form-urlencoded", "application/x-www-form-urlencoded",
].includes(this.contentType) ].includes(this.contentType)
}, },