Skip to content

Commit

Permalink
更新在线签名
Browse files Browse the repository at this point in the history
  • Loading branch information
72161674 committed Dec 8, 2023
1 parent cb891e5 commit ea16271
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/hap-packager/src/plugins/sign-online-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,17 @@ SignOnlinePlugin.prototype.apply = function (compiler) {

let form = null

const headers = {}

const file = fs.createReadStream(noSignFilePath)

if (options.formData && options.formData(file)) {
form = options.formData(file)
const fileSizeInBytes = fs.statSync(noSignFilePath).size

if (options.formData && options.formData(file, fileSizeInBytes)) {
form = options.formData(file, fileSizeInBytes)
}

form && Object.assign(options.headers(), form.getHeaders())
form && Object.assign(headers, options.headers(), form.getHeaders())

const url = new URL(requestPath)
const param = {
Expand All @@ -46,7 +50,7 @@ SignOnlinePlugin.prototype.apply = function (compiler) {
path: url.pathname,
method: 'POST',
timeout: 10000,
headers: options.headers
headers
}
const req = http
.request(param, (res) => {
Expand Down

0 comments on commit ea16271

Please sign in to comment.