chia-agent 14.3.0 → 14.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## [14.3.1]
4
+ ### Changed
5
+ - Added a `Host` header when sending https request to a remote host.
6
+
3
7
  ## [14.3.0]
4
8
  ### Changed
5
9
  - Removed `RpcWalletMessageOnWs` since it's costly to maintain while there are a few use cases.
@@ -1704,6 +1708,7 @@ daemon.sendMessage(destination, get_block_record_by_height_command, data);
1704
1708
  Initial release.
1705
1709
 
1706
1710
  <!-- [Unreleased]: https://github.com/Chia-Mine/chia-agent/compare/v0.0.1...v0.0.2 -->
1711
+ [14.3.1]: https://github.com/Chia-Mine/chia-agent/compare/v14.3.0...v14.3.1
1707
1712
  [14.3.0]: https://github.com/Chia-Mine/chia-agent/compare/v14.2.2...v14.3.0
1708
1713
  [14.2.2]: https://github.com/Chia-Mine/chia-agent/compare/v14.2.1...v14.2.2
1709
1714
  [14.2.1]: https://github.com/Chia-Mine/chia-agent/compare/v14.2.0...v14.2.1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chia-agent",
3
- "version": "14.3.0",
3
+ "version": "14.3.1",
4
4
  "author": "ChiaMineJP <admin@chiamine.jp>",
5
5
  "description": "chia rpc/websocket client library",
6
6
  "license": "MIT",
package/rpc/index.js CHANGED
@@ -202,14 +202,19 @@ class RPCAgent {
202
202
  const body = data ? JSONbig.stringify(data) : "{}";
203
203
  const pathname = `/${path.replace(/^\/+/, "")}`;
204
204
  const METHOD = method.toUpperCase();
205
+ const headers = {
206
+ Accept: "application/json, text/plain, */*",
207
+ "User-Agent": userAgent,
208
+ };
209
+ if ("options" in this._agent && typeof this._agent.options.host === "string") {
210
+ // Assuming `this._agent instanceof HttpsAgent` is true.
211
+ headers.Host = this._agent.options.host;
212
+ }
205
213
  const options = {
206
214
  path: pathname,
207
215
  method: METHOD,
208
216
  agent: this._agent,
209
- headers: {
210
- Accept: "application/json, text/plain, */*",
211
- "User-Agent": userAgent,
212
- },
217
+ headers,
213
218
  };
214
219
  if (this._skip_hostname_verification) {
215
220
  options.checkServerIdentity = () => {