|
@@ -157,7 +157,7 @@ class Client {
|
157
|
157
|
}
|
158
|
158
|
|
159
|
159
|
// 设置请求属性
|
160
|
|
- setRequestProperty(key, value) {
|
|
160
|
+ setRequestProperty(key: string, value: string) {
|
161
|
161
|
let v = this.getRequestProperty(key);
|
162
|
162
|
|
163
|
163
|
this.requestHeader = this.requestHeader.replace(key + '=' + v + ';', '');
|
|
@@ -165,18 +165,22 @@ class Client {
|
165
|
165
|
}
|
166
|
166
|
|
167
|
167
|
// 获取请求属性
|
168
|
|
- getRequestProperty(key) {
|
169
|
|
- let values = this.requestHeader.split(';');
|
170
|
|
- for (let index in values) {
|
171
|
|
- let kv = values[index].split('=');
|
172
|
|
- if (kv[0] === key) {
|
173
|
|
- return kv[1];
|
|
168
|
+ getRequestProperty(key: string): string {
|
|
169
|
+ if (this.requestHeader !== undefined) {
|
|
170
|
+ let values = this.requestHeader.split(';');
|
|
171
|
+ for (let index in values) {
|
|
172
|
+ let kv = values[index].split('=');
|
|
173
|
+ if (kv[0] === key) {
|
|
174
|
+ return kv[1];
|
|
175
|
+ }
|
174
|
176
|
}
|
175
|
177
|
}
|
|
178
|
+
|
|
179
|
+ return '';
|
176
|
180
|
}
|
177
|
181
|
|
178
|
182
|
// 设置Response属性
|
179
|
|
- setResponseProperty(key, value) {
|
|
183
|
+ setResponseProperty(key: string, value: string) {
|
180
|
184
|
let v = this.getResponseProperty(key);
|
181
|
185
|
|
182
|
186
|
this.responseHeader = this.responseHeader.replace(key + '=' + v + ';', '');
|
|
@@ -184,12 +188,14 @@ class Client {
|
184
|
188
|
}
|
185
|
189
|
|
186
|
190
|
// 获取响应属性
|
187
|
|
- getResponseProperty(key): string {
|
188
|
|
- let values = this.responseHeader.split(';');
|
189
|
|
- for (let index in values) {
|
190
|
|
- let kv = values[index].split('=');
|
191
|
|
- if (kv[0] === key) {
|
192
|
|
- return kv[1];
|
|
191
|
+ getResponseProperty(key: string): string {
|
|
192
|
+ if (this.responseHeader !== undefined) {
|
|
193
|
+ let values = this.responseHeader.split(';');
|
|
194
|
+ for (let index in values) {
|
|
195
|
+ let kv = values[index].split('=');
|
|
196
|
+ if (kv[0] === key) {
|
|
197
|
+ return kv[1];
|
|
198
|
+ }
|
193
|
199
|
}
|
194
|
200
|
}
|
195
|
201
|
|