Skip to content

Commit 5f7c34b

Browse files
committed
NO-ISSUE Authorization header is not required in module-attach client
1 parent e9fab8b commit 5f7c34b

File tree

11 files changed

+93
-6
lines changed

11 files changed

+93
-6
lines changed

generator/src/main/resources/line-bot-sdk-nodejs-generator/api-single.pebble

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ import {AxiosResponse} from "axios";
2121
interface httpClientConfig {
2222
baseURL?: string;
2323
{% if authMethods != null -%}
24-
channelAccessToken: string;
24+
{% for authMethod in authMethods %}
25+
{% if authMethod.isBasicBearer %}
26+
channelAccessToken: string;
27+
{% else %}
28+
{% endif %}
29+
{% endfor %}
2530
{% endif -%}
2631
// TODO support defaultHeaders?
2732
}
@@ -37,7 +42,12 @@ export class {{operations.classname}} {
3742
this.httpClient = new HTTPClient({
3843
defaultHeaders: {
3944
{% if authMethods != null -%}
40-
Authorization: "Bearer " + config.channelAccessToken,
45+
{% for authMethod in authMethods %}
46+
{% if authMethod.isBasicBearer %}
47+
Authorization: "Bearer " + config.channelAccessToken,
48+
{% else %}
49+
{% endif %}
50+
{% endfor %}
4151
{% endif -%}
4252
},
4353
responseParser: this.parseHTTPResponse.bind(this),

lib/insight/api/insightClient.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ import { AxiosResponse } from "axios";
3030

3131
interface httpClientConfig {
3232
baseURL?: string;
33+
3334
channelAccessToken: string;
35+
3436
// TODO support defaultHeaders?
3537
}
3638

lib/liff/api/liffClient.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ import { AxiosResponse } from "axios";
2929

3030
interface httpClientConfig {
3131
baseURL?: string;
32+
3233
channelAccessToken: string;
34+
3335
// TODO support defaultHeaders?
3436
}
3537

lib/manage-audience/api/manageAudienceBlobClient.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ import { AxiosResponse } from "axios";
2626

2727
interface httpClientConfig {
2828
baseURL?: string;
29+
2930
channelAccessToken: string;
31+
3032
// TODO support defaultHeaders?
3133
}
3234

lib/manage-audience/api/manageAudienceClient.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ import { AxiosResponse } from "axios";
4040

4141
interface httpClientConfig {
4242
baseURL?: string;
43+
4344
channelAccessToken: string;
45+
4446
// TODO support defaultHeaders?
4547
}
4648

lib/messaging-api/api/messagingApiBlobClient.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ import { AxiosResponse } from "axios";
2626

2727
interface httpClientConfig {
2828
baseURL?: string;
29+
2930
channelAccessToken: string;
31+
3032
// TODO support defaultHeaders?
3133
}
3234

lib/messaging-api/api/messagingApiClient.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ import { AxiosResponse } from "axios";
6969

7070
interface httpClientConfig {
7171
baseURL?: string;
72+
7273
channelAccessToken: string;
74+
7375
// TODO support defaultHeaders?
7476
}
7577

lib/module-attach/api/lineModuleAttachClient.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { AxiosResponse } from "axios";
2626

2727
interface httpClientConfig {
2828
baseURL?: string;
29-
channelAccessToken: string;
29+
3030
// TODO support defaultHeaders?
3131
}
3232

@@ -38,9 +38,7 @@ export class LineModuleAttachClient {
3838
config.baseURL = "https://manager.line.biz";
3939
}
4040
this.httpClient = new HTTPClient({
41-
defaultHeaders: {
42-
Authorization: "Bearer " + config.channelAccessToken,
43-
},
41+
defaultHeaders: {},
4442
responseParser: this.parseHTTPResponse.bind(this),
4543
baseURL: config.baseURL,
4644
});

lib/module/api/lineModuleClient.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ import { AxiosResponse } from "axios";
2828

2929
interface httpClientConfig {
3030
baseURL?: string;
31+
3132
channelAccessToken: string;
33+
3234
// TODO support defaultHeaders?
3335
}
3436

lib/shop/api/shopClient.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ import { AxiosResponse } from "axios";
2626

2727
interface httpClientConfig {
2828
baseURL?: string;
29+
2930
channelAccessToken: string;
31+
3032
// TODO support defaultHeaders?
3133
}
3234

0 commit comments

Comments
 (0)