Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ export class {{classname}} {
return false;
}

public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp('(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$');
return mime != null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
}

{{#operation}}
/**
* {{&notes}}
Expand Down Expand Up @@ -175,6 +180,11 @@ export class {{classname}} {
'{{{mediaType}}}'{{#hasMore}},{{/hasMore}}
{{/consumes}}
];

if (consumes != null && consumes.length > 0) {
headers.set('Content-Type', consumes.filter(item => this.isJsonMime(item)).join(";"));
}

let canConsumeForm = this.canConsumeForm(consumes);
let useForm = false;
{{#formParams}}
Expand All @@ -194,6 +204,10 @@ export class {{classname}} {
{{/produces}}
];

if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}

{{#authMethods}}
// authentication ({{name}}) required
{{#isApiKey}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ export class PetService {
'application/json'
];

if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
}

// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
Expand Down Expand Up @@ -285,6 +289,10 @@ export class PetService {
'application/json'
];

if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
}

// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
Expand Down Expand Up @@ -335,6 +343,10 @@ export class PetService {
'application/json'
];

if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
}

// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
Expand Down Expand Up @@ -385,6 +397,10 @@ export class PetService {
'application/json'
];

if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
}

// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
Expand Down Expand Up @@ -432,6 +448,10 @@ export class PetService {
'application/json'
];

if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
}

// authentication (api_key) required
if (this.configuration.apiKeys["api_key"]) {
headers.set('api_key', this.configuration.apiKeys["api_key"]);
Expand Down Expand Up @@ -474,6 +494,10 @@ export class PetService {
'application/json'
];

if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
}

// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
Expand Down Expand Up @@ -523,6 +547,11 @@ export class PetService {
let consumes: string[] = [
'application/x-www-form-urlencoded'
];

if ((consumes != null) && (consumes.length > 0)) {
headers.set('Content-Type', consumes.join(';'));
}

let canConsumeForm = this.canConsumeForm(consumes);
let useForm = false;
let formParams = new (useForm ? FormData : URLSearchParams as any)() as {
Expand All @@ -535,6 +564,10 @@ export class PetService {
'application/json'
];

if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
}

// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
Expand Down Expand Up @@ -590,6 +623,11 @@ export class PetService {
let consumes: string[] = [
'multipart/form-data'
];

if ((consumes != null) && (consumes.length > 0)) {
headers.set('Content-Type', consumes.join(';'));
}

let canConsumeForm = this.canConsumeForm(consumes);
let useForm = false;
useForm = canConsumeForm;
Expand All @@ -602,6 +640,10 @@ export class PetService {
'application/json'
];

if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
}

// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ export class StoreService {
'application/json'
];

if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
}


let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Delete,
Expand Down Expand Up @@ -191,6 +195,10 @@ export class StoreService {
'application/json'
];

if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
}

// authentication (api_key) required
if (this.configuration.apiKeys["api_key"]) {
headers.set('api_key', this.configuration.apiKeys["api_key"]);
Expand Down Expand Up @@ -234,6 +242,10 @@ export class StoreService {
'application/json'
];

if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
}


let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get,
Expand Down Expand Up @@ -271,6 +283,10 @@ export class StoreService {
'application/json'
];

if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
}


headers.set('Content-Type', 'application/json');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ export class UserService {
'application/json'
];

if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
}


headers.set('Content-Type', 'application/json');

Expand Down Expand Up @@ -265,6 +269,10 @@ export class UserService {
'application/json'
];

if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
}


headers.set('Content-Type', 'application/json');

Expand Down Expand Up @@ -305,6 +313,10 @@ export class UserService {
'application/json'
];

if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
}


headers.set('Content-Type', 'application/json');

Expand Down Expand Up @@ -346,6 +358,10 @@ export class UserService {
'application/json'
];

if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
}


let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Delete,
Expand Down Expand Up @@ -384,6 +400,10 @@ export class UserService {
'application/json'
];

if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
}


let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get,
Expand Down Expand Up @@ -434,6 +454,10 @@ export class UserService {
'application/json'
];

if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
}


let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get,
Expand Down Expand Up @@ -466,6 +490,10 @@ export class UserService {
'application/json'
];

if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
}


let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get,
Expand Down Expand Up @@ -509,6 +537,10 @@ export class UserService {
'application/json'
];

if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
}


headers.set('Content-Type', 'application/json');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ export class PetService {
'application/json'
];

if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
}

// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
Expand Down Expand Up @@ -285,6 +289,10 @@ export class PetService {
'application/json'
];

if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
}

// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
Expand Down Expand Up @@ -335,6 +343,10 @@ export class PetService {
'application/json'
];

if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
}

// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
Expand Down Expand Up @@ -385,6 +397,10 @@ export class PetService {
'application/json'
];

if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
}

// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
Expand Down Expand Up @@ -432,6 +448,10 @@ export class PetService {
'application/json'
];

if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
}

// authentication (api_key) required
if (this.configuration.apiKeys["api_key"]) {
headers.set('api_key', this.configuration.apiKeys["api_key"]);
Expand Down Expand Up @@ -474,6 +494,10 @@ export class PetService {
'application/json'
];

if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
}

// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
Expand Down Expand Up @@ -523,6 +547,11 @@ export class PetService {
let consumes: string[] = [
'application/x-www-form-urlencoded'
];

if ((consumes != null) && (consumes.length > 0)) {
headers.set('Content-Type', consumes.join(';'));
}

let canConsumeForm = this.canConsumeForm(consumes);
let useForm = false;
let formParams = new (useForm ? FormData : URLSearchParams as any)() as {
Expand All @@ -535,6 +564,10 @@ export class PetService {
'application/json'
];

if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
}

// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
Expand Down Expand Up @@ -590,6 +623,11 @@ export class PetService {
let consumes: string[] = [
'multipart/form-data'
];

if ((consumes != null) && (consumes.length > 0)) {
headers.set('Content-Type', consumes.join(';'));
}

let canConsumeForm = this.canConsumeForm(consumes);
let useForm = false;
useForm = canConsumeForm;
Expand All @@ -602,6 +640,10 @@ export class PetService {
'application/json'
];

if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
}

// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
Expand Down
Loading