0.4.3 (2022-10-06)
-
Add
full
to responseresponseFormatter
. Full will returnbody
,headers
andstatusCode
-
Allow
responseFormatter
to be custom function -
Bump deps
0.4.2 (2021-06-17)
- Added TypeScript declaration file (
index.d.ts
) to support use ofimport
statements instead ofrequire
in moleculerjs TS projects to resolve thetypescript-eslint/no-var-requires
error that is thrown during the linting.
0.4.1 (2021-03-01)
- Fixed "Converting circular structure to JSON" error. More info here.
0.4.0 (2020-08-20)
- Got HTTP client was updated to
v11
. Check Got's release notes for more info about the changes inv11
.
0.3.0 (2020-01-16)
includeMethods
option have been dropped. Now, by default, all actions are created. If you still want to disable some action you can create a mixin that will remove unwanted methods or just set the undesired action tofalse
in your service. For example:
// Create a service
broker.createService({
name: "http",
// Load HTTP Client Service
mixins: [HTTPClientService],
settings: {
// Only GET the body of the response
httpClient: { responseFormatter: "body" }
},
// Disable HTTP GET action
actions: {
get: false
}
});
0.2.0 (2020-01-02)
-
Due to Node.js v8 End-Of-Life we no longer support it
-
Got HTTP client was updated to
v10
. Check Got's release notes for more info about the changes inv10
. -
The overall API is the same. The only change is the
opt
param that is passed along with theurl
.
For the complete list of changes check the Got's docs
broker.call("http.get", {
url: "https://httpbin.org/json",
opt: { json: true }
}
broker.call("http.get", {
url: "https://httpbin.org/json",
opt: { responseType: "json" } // can also be `text` or `buffer`
})
broker.call("http.get", {
url: "https://httpbin.org/json",
opt: { body: { foo: "bar" }, json: true }
}
broker.call("http.post", {
url: "https://httpbin.org/post",
opt: { json: { foo: "bar" }, responseType: "json" }
})
broker.call("http.get", {
url: "https://sindresorhus.com/",
opt: { stream: true }
})
broker.call("http.get", {
url: "https://sindresorhus.com/",
opt: { isStream: true }
})