Skip to content

Commit

Permalink
Use valid JS RegEx (#6584)
Browse files Browse the repository at this point in the history
  • Loading branch information
yissachar authored and wing328 committed Sep 28, 2017
1 parent 4b9ee1f commit bd5b586
Show file tree
Hide file tree
Showing 14 changed files with 115 additions and 115 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class {{classname}} {
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class PetService {
}

/**
*
*
* Extends object by coping non-existing properties.
* @param objA object to be extended
* @param objB source object
Expand Down Expand Up @@ -75,7 +75,7 @@ export class PetService {
}

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

Expand Down Expand Up @@ -248,7 +248,7 @@ export class PetService {
headers.set('Authorization', 'Bearer ' + accessToken);
}


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

let requestOptions: RequestOptionsArgs = new RequestOptions({
Expand Down Expand Up @@ -307,7 +307,7 @@ export class PetService {
headers.set('Authorization', 'Bearer ' + accessToken);
}


let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Delete,
headers: headers,
Expand Down Expand Up @@ -361,7 +361,7 @@ export class PetService {
headers.set('Authorization', 'Bearer ' + accessToken);
}


let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get,
headers: headers,
Expand Down Expand Up @@ -415,7 +415,7 @@ export class PetService {
headers.set('Authorization', 'Bearer ' + accessToken);
}


let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get,
headers: headers,
Expand Down Expand Up @@ -462,7 +462,7 @@ export class PetService {
headers.set('api_key', this.configuration.apiKeys["api_key"]);
}


let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get,
headers: headers,
Expand Down Expand Up @@ -512,7 +512,7 @@ export class PetService {
headers.set('Authorization', 'Bearer ' + accessToken);
}


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

let requestOptions: RequestOptionsArgs = new RequestOptions({
Expand Down Expand Up @@ -582,7 +582,7 @@ export class PetService {
headers.set('Authorization', 'Bearer ' + accessToken);
}


if (name !== undefined) {
formParams.set('name', <any>name);
}
Expand Down Expand Up @@ -658,7 +658,7 @@ export class PetService {
headers.set('Authorization', 'Bearer ' + accessToken);
}


if (additionalMetadata !== undefined) {
formParams.set('additionalMetadata', <any>additionalMetadata);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class StoreService {
}

/**
*
*
* Extends object by coping non-existing properties.
* @param objA object to be extended
* @param objB source object
Expand Down Expand Up @@ -74,7 +74,7 @@ export class StoreService {
}

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

Expand Down Expand Up @@ -169,7 +169,7 @@ export class StoreService {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}


let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Delete,
headers: headers,
Expand Down Expand Up @@ -209,7 +209,7 @@ export class StoreService {
headers.set('api_key', this.configuration.apiKeys["api_key"]);
}


let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get,
headers: headers,
Expand Down Expand Up @@ -251,7 +251,7 @@ export class StoreService {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}


let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get,
headers: headers,
Expand Down Expand Up @@ -292,7 +292,7 @@ export class StoreService {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}


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

let requestOptions: RequestOptionsArgs = new RequestOptions({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class UserService {
}

/**
*
*
* Extends object by coping non-existing properties.
* @param objA object to be extended
* @param objB source object
Expand Down Expand Up @@ -74,7 +74,7 @@ export class UserService {
}

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

Expand Down Expand Up @@ -234,7 +234,7 @@ export class UserService {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}


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

let requestOptions: RequestOptionsArgs = new RequestOptions({
Expand Down Expand Up @@ -278,7 +278,7 @@ export class UserService {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}


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

let requestOptions: RequestOptionsArgs = new RequestOptions({
Expand Down Expand Up @@ -322,7 +322,7 @@ export class UserService {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}


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

let requestOptions: RequestOptionsArgs = new RequestOptions({
Expand Down Expand Up @@ -367,7 +367,7 @@ export class UserService {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}


let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Delete,
headers: headers,
Expand Down Expand Up @@ -409,7 +409,7 @@ export class UserService {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}


let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get,
headers: headers,
Expand Down Expand Up @@ -463,7 +463,7 @@ export class UserService {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}


let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get,
headers: headers,
Expand Down Expand Up @@ -499,7 +499,7 @@ export class UserService {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}


let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get,
headers: headers,
Expand Down Expand Up @@ -546,7 +546,7 @@ export class UserService {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}


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

let requestOptions: RequestOptionsArgs = new RequestOptions({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class PetService {
}

/**
*
*
* Extends object by coping non-existing properties.
* @param objA object to be extended
* @param objB source object
Expand Down Expand Up @@ -75,7 +75,7 @@ export class PetService {
}

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

Expand Down Expand Up @@ -248,7 +248,7 @@ export class PetService {
headers.set('Authorization', 'Bearer ' + accessToken);
}


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

let requestOptions: RequestOptionsArgs = new RequestOptions({
Expand Down Expand Up @@ -307,7 +307,7 @@ export class PetService {
headers.set('Authorization', 'Bearer ' + accessToken);
}


let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Delete,
headers: headers,
Expand Down Expand Up @@ -361,7 +361,7 @@ export class PetService {
headers.set('Authorization', 'Bearer ' + accessToken);
}


let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get,
headers: headers,
Expand Down Expand Up @@ -415,7 +415,7 @@ export class PetService {
headers.set('Authorization', 'Bearer ' + accessToken);
}


let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get,
headers: headers,
Expand Down Expand Up @@ -462,7 +462,7 @@ export class PetService {
headers.set('api_key', this.configuration.apiKeys["api_key"]);
}


let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get,
headers: headers,
Expand Down Expand Up @@ -512,7 +512,7 @@ export class PetService {
headers.set('Authorization', 'Bearer ' + accessToken);
}


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

let requestOptions: RequestOptionsArgs = new RequestOptions({
Expand Down Expand Up @@ -582,7 +582,7 @@ export class PetService {
headers.set('Authorization', 'Bearer ' + accessToken);
}


if (name !== undefined) {
formParams.set('name', <any>name);
}
Expand Down Expand Up @@ -658,7 +658,7 @@ export class PetService {
headers.set('Authorization', 'Bearer ' + accessToken);
}


if (additionalMetadata !== undefined) {
formParams.set('additionalMetadata', <any>additionalMetadata);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class StoreService {
}

/**
*
*
* Extends object by coping non-existing properties.
* @param objA object to be extended
* @param objB source object
Expand Down Expand Up @@ -74,7 +74,7 @@ export class StoreService {
}

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

Expand Down Expand Up @@ -169,7 +169,7 @@ export class StoreService {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}


let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Delete,
headers: headers,
Expand Down Expand Up @@ -209,7 +209,7 @@ export class StoreService {
headers.set('api_key', this.configuration.apiKeys["api_key"]);
}


let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get,
headers: headers,
Expand Down Expand Up @@ -251,7 +251,7 @@ export class StoreService {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}


let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get,
headers: headers,
Expand Down Expand Up @@ -292,7 +292,7 @@ export class StoreService {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}


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

let requestOptions: RequestOptionsArgs = new RequestOptions({
Expand Down
Loading

0 comments on commit bd5b586

Please sign in to comment.