mirror of
https://github.com/ragestudio/linebridge.git
synced 2025-06-09 10:34:17 +00:00
added default headers
This commit is contained in:
parent
4eaa4dd48b
commit
51541f5ae8
@ -8,6 +8,9 @@ const generateWSRequestDispatcher = require("./generateWSRequestDispatcher")
|
||||
const FixedMethods = {
|
||||
"del": "delete"
|
||||
}
|
||||
const DefaultHeaders = {
|
||||
"Content-Type": "application/x-www-form-urlencoded"
|
||||
}
|
||||
|
||||
module.exports = class Bridge {
|
||||
constructor(params = {}, events = {}) {
|
||||
@ -15,7 +18,10 @@ module.exports = class Bridge {
|
||||
this.events = events
|
||||
|
||||
this.origin = this.params.origin
|
||||
this.headers = { ...this.params.headers }
|
||||
this.headers = {
|
||||
...DefaultHeaders,
|
||||
...this.params.headers,
|
||||
}
|
||||
|
||||
this.httpInterface = axios.create({
|
||||
baseURL: this.origin,
|
||||
@ -126,7 +132,8 @@ module.exports = class Bridge {
|
||||
fixedMethod,
|
||||
route,
|
||||
this.handleRequestContext,
|
||||
this.handleResponse
|
||||
this.handleResponse,
|
||||
this.params.requestHeaders
|
||||
)
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user