Skip to content

Commit 19b76cb

Browse files
committed
fix(capi): add isPascalCase option
1 parent f23c032 commit 19b76cb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/capi/src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export { tencentSign, tencentSignV1 } from './utils';
77
export * from './factory';
88

99
export interface CapiOptions {
10+
isPascalCase?: boolean; // whether api parameter need use pascalCase to handler
1011
isV3?: boolean; // whether to use version3 sign method
1112
debug?: boolean; // whether enable log debug info
1213
host?: string; // request host
@@ -65,6 +66,7 @@ export class Capi implements CapiInstance {
6566
secretKey: '',
6667
region: 'ap-guangzhou',
6768
signatureMethod: 'sha1', // sign algorithm, default is sha1
69+
isPascalCase: true,
6870
};
6971

7072
constructor(options: CapiOptions) {
@@ -88,7 +90,7 @@ export class Capi implements CapiInstance {
8890
};
8991
if (isV3 || opts.isV3) {
9092
const { url, payload, authorization, timestamp, host } = tencentSign(
91-
pascalCaseProps(restData),
93+
this.options.isPascalCase ? pascalCaseProps(restData) : restData,
9294
options,
9395
);
9496
reqOption = {
@@ -112,7 +114,7 @@ export class Capi implements CapiInstance {
112114
}
113115
} else {
114116
const { url, method, payload } = tencentSignV1(
115-
pascalCaseProps(data),
117+
this.options.isPascalCase ? pascalCaseProps(data) : data,
116118
options,
117119
);
118120
reqOption = {

0 commit comments

Comments
 (0)