Skip to content

Latest commit

 

History

History
107 lines (87 loc) · 3.22 KB

CHANGELOG.md

File metadata and controls

107 lines (87 loc) · 3.22 KB

0.4.3 (2022-10-06)

  • Add full to response responseFormatter. Full will return body, headers and statusCode

  • Allow responseFormatter to be custom function

  • Bump deps

0.4.2 (2021-06-17)

  • Added TypeScript declaration file (index.d.ts) to support use of import statements instead of require in moleculerjs TS projects to resolve the typescript-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 in v11.

0.3.0 (2020-01-16)

Breaking changes

  • 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 to false 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)

Breaking changes

  • 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 in v10.

  • The overall API is the same. The only change is the opt param that is passed along with the url.

Some of opt Param Changes

For the complete list of changes check the Got's docs

GET JSON Data

Previously

broker.call("http.get", {
  url: "https://httpbin.org/json",
  opt: { json: true }
}

Now

broker.call("http.get", {
  url: "https://httpbin.org/json",
  opt: { responseType: "json" } // can also be `text` or `buffer`
})

POST JSON Data

Previously

broker.call("http.get", {
  url: "https://httpbin.org/json",
  opt: { body: { foo: "bar" }, json: true }
}

Now

broker.call("http.post", {
  url: "https://httpbin.org/post",
  opt: { json: { foo: "bar" }, responseType: "json" }
})

GET Stream

Previously

broker.call("http.get", {
  url: "https://sindresorhus.com/",
  opt: { stream: true }
})

Now

broker.call("http.get", {
  url: "https://sindresorhus.com/",
  opt: { isStream: true }
})