Skip to content

Commit

Permalink
更新在线签名 (#58)
Browse files Browse the repository at this point in the history
Co-authored-by: 72161674 <[email protected]>
  • Loading branch information
xingfujiang and 72161674 authored Feb 19, 2024
1 parent cb891e5 commit 503e2ab
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 503e2ab

Please sign in to comment.