From 5ba16d1ac04963999c5570dfe63b2ddfbf8d25d7 Mon Sep 17 00:00:00 2001 From: leejinho Date: Fri, 20 Mar 2020 18:15:21 +0900 Subject: [PATCH] =?UTF-8?q?bugfix=20::=20login=20=EC=8B=9C=20=ED=95=84?= =?UTF-8?q?=EB=93=9C=EC=97=90=20'+'=20=EB=AC=B8=EC=9E=90=EA=B0=80=20?= =?UTF-8?q?=EB=B9=88=EB=AC=B8=EC=9E=90=EB=A1=9C=20=EC=B9=98=ED=99=98?= =?UTF-8?q?=EB=90=98=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20=EC=88=98=EC=A0=95.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/lib/apis/httpUrlEncodingCodec.ts | 20 +++++++++++++++++++ .../ucap-webmessenger-api/src/public-api.ts | 1 + .../src/lib/apis/login2.ts | 17 ++++++++++++++-- 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 projects/ucap-webmessenger-api/src/lib/apis/httpUrlEncodingCodec.ts diff --git a/projects/ucap-webmessenger-api/src/lib/apis/httpUrlEncodingCodec.ts b/projects/ucap-webmessenger-api/src/lib/apis/httpUrlEncodingCodec.ts new file mode 100644 index 00000000..a4a06373 --- /dev/null +++ b/projects/ucap-webmessenger-api/src/lib/apis/httpUrlEncodingCodec.ts @@ -0,0 +1,20 @@ +import { HttpParameterCodec } from '@angular/common/http'; + +export class HttpUrlEncodingCodec implements HttpParameterCodec { + encodeKey(k: string): string { + return this.standardEncoding(k); + } + encodeValue(v: string): string { + return this.standardEncoding(v); + } + decodeKey(k: string): string { + return decodeURIComponent(k); + } + decodeValue(v: string) { + return decodeURIComponent(v); + } + + standardEncoding(v: string): string { + return encodeURIComponent(v); + } +} diff --git a/projects/ucap-webmessenger-api/src/public-api.ts b/projects/ucap-webmessenger-api/src/public-api.ts index 25527679..3258d83d 100644 --- a/projects/ucap-webmessenger-api/src/public-api.ts +++ b/projects/ucap-webmessenger-api/src/public-api.ts @@ -3,6 +3,7 @@ */ export * from './lib/apis/api'; +export * from './lib/apis/httpUrlEncodingCodec'; export * from './lib/types/message-status-code.type'; export * from './lib/types/status-code.type'; diff --git a/projects/ucap-webmessenger-pi/src/lib/apis/login2.ts b/projects/ucap-webmessenger-pi/src/lib/apis/login2.ts index 540017ca..20aba5a9 100644 --- a/projects/ucap-webmessenger-pi/src/lib/apis/login2.ts +++ b/projects/ucap-webmessenger-pi/src/lib/apis/login2.ts @@ -1,6 +1,12 @@ -import { ParameterUtil, APIEncoder, APIDecoder } from '@ucap-webmessenger/api'; +import { + ParameterUtil, + APIEncoder, + APIDecoder, + HttpUrlEncodingCodec +} from '@ucap-webmessenger/api'; import { PIRequest, PIResponse } from './pi'; +import { HttpParams, HttpParameterCodec } from '@angular/common/http'; export interface Login2Request extends PIRequest { companyCode: string; @@ -26,7 +32,14 @@ const login2EncodeMap = { }; export const encodeLogin2: APIEncoder = (req: Login2Request) => { - return ParameterUtil.encode(login2EncodeMap, req); + let parameter: HttpParams = new HttpParams({ + encoder: new HttpUrlEncodingCodec() + }); + parameter = parameter.append('companyCd', req.companyCode); + parameter = parameter.append('loginId', req.loginId); + parameter = parameter.append('loginPw', req.loginPw); + return parameter; + // return ParameterUtil.encodeForm(login2EncodeMap, req); }; export const decodeLogin2: APIDecoder = (res: any) => {