-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[typescript-angular] add customized encoder to use '+' char in query …
- Loading branch information
Showing
21 changed files
with
190 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
modules/swagger-codegen/src/main/resources/typescript-angular/encoder.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { QueryEncoder } from "@angular/http"; | ||
|
||
/** | ||
* CustomQueryEncoderHelper | ||
* Fix plus sign (+) not encoding, so sent as blank space | ||
* See: https://github.com/angular/angular/issues/11058#issuecomment-247367318 | ||
*/ | ||
export class CustomQueryEncoderHelper extends QueryEncoder { | ||
encodeKey(k: string): string { | ||
k = super.encodeKey(k); | ||
return k.replace(/\+/gi, '%2B'); | ||
} | ||
encodeValue(v: string): string { | ||
v = super.encodeValue(v); | ||
return v.replace(/\+/gi, '%2B'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
samples/client/petstore/typescript-angular-v2/default/encoder.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { QueryEncoder } from "@angular/http"; | ||
|
||
/** | ||
* CustomQueryEncoderHelper | ||
* Fix plus sign (+) not encoding, so sent as blank space | ||
* See: https://github.com/angular/angular/issues/11058#issuecomment-247367318 | ||
*/ | ||
export class CustomQueryEncoderHelper extends QueryEncoder { | ||
encodeKey(k: string): string { | ||
k = super.encodeKey(k); | ||
return k.replace(/\+/gi, '%2B'); | ||
} | ||
encodeValue(v: string): string { | ||
v = super.encodeValue(v); | ||
return v.replace(/\+/gi, '%2B'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.