Compare commits

..

174 Commits

Author SHA1 Message Date
Nurzhan Ilyassov
916d248147 update tests 2024-03-31 20:21:25 +03:00
Nurzhan Ilyassov
bc59fcb886 fix nil nmsg in case of empty request body 2024-03-31 20:21:25 +03:00
7ea55fb466 update for latest micro
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2024-03-25 21:12:26 +03:00
76a0bdd67c Merge pull request 'update for latest micro changes' (#114) from options into master
Reviewed-on: #114
2023-08-12 13:18:05 +03:00
8de525a8f8 update for latest micro changes
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2023-08-12 13:17:47 +03:00
ef36082f2e Merge pull request 'fix request/response md handling' (#112) from request-respone-md into master
Reviewed-on: #112
2023-07-11 00:48:38 +03:00
21c897be47 fix request/response md handling
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2023-07-11 00:47:36 +03:00
0b21dd6660 Merge pull request 'move to micro v4' (#109) from v4 into master
Reviewed-on: #109
2023-04-28 22:29:44 +03:00
18eb0d9e5c move to micro v4
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2023-04-28 22:29:18 +03:00
3f44a41d30 Merge pull request 'simplify rsp parse' (#108) from logrsp into v3
Reviewed-on: #108
2023-03-16 19:17:12 +03:00
090100e522 simplify rsp parse
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2023-03-16 19:16:35 +03:00
0bf8053d72 Merge pull request 'logging: add debug logging for request and response' (#107) from logging into v3
Reviewed-on: #107
2023-03-15 22:26:58 +03:00
42bdd79b3d add debug logging for request and response
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2023-03-15 22:26:14 +03:00
5fa952c86a
Merge pull request #107 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.10.16
Bump go.unistack.org/micro/v3 from 3.10.14 to 3.10.16
2023-03-14 22:00:27 +03:00
dependabot[bot]
d861c31a05
Bump go.unistack.org/micro/v3 from 3.10.14 to 3.10.16
Bumps go.unistack.org/micro/v3 from 3.10.14 to 3.10.16.

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-14 18:58:37 +00:00
e7dc59157d
Merge pull request #106 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.10.14
Bump go.unistack.org/micro/v3 from 3.10.13 to 3.10.14
2023-02-27 22:08:00 +03:00
dependabot[bot]
7f7081e6e8
Bump go.unistack.org/micro/v3 from 3.10.13 to 3.10.14
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.10.13 to 3.10.14.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.10.13...v3.10.14)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-27 19:06:37 +00:00
d441f151e0
Merge pull request #105 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.10.13
Bump go.unistack.org/micro/v3 from 3.10.12 to 3.10.13
2023-02-22 21:13:36 +03:00
dependabot[bot]
6a6be26ef1
Bump go.unistack.org/micro/v3 from 3.10.12 to 3.10.13
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.10.12 to 3.10.13.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.10.12...v3.10.13)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-22 18:11:53 +00:00
d1d5e0f4ac
Merge pull request #104 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.10.12
Bump go.unistack.org/micro/v3 from 3.10.11 to 3.10.12
2023-02-21 22:32:42 +03:00
dependabot[bot]
3f8976ee62
Bump go.unistack.org/micro/v3 from 3.10.11 to 3.10.12
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.10.11 to 3.10.12.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.10.11...v3.10.12)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-21 19:30:23 +00:00
2078f2e700
Merge pull request #103 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.10.11
Bump go.unistack.org/micro/v3 from 3.10.10 to 3.10.11
2023-02-14 22:00:49 +03:00
dependabot[bot]
007d45fc7b
Bump go.unistack.org/micro/v3 from 3.10.10 to 3.10.11
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.10.10 to 3.10.11.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.10.10...v3.10.11)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-14 18:58:54 +00:00
6c84752ccd
Merge pull request #102 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.10.10
Bump go.unistack.org/micro/v3 from 3.10.9 to 3.10.10
2023-02-13 22:17:58 +03:00
dependabot[bot]
54d21ba6e1
Bump go.unistack.org/micro/v3 from 3.10.9 to 3.10.10
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.10.9 to 3.10.10.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.10.9...v3.10.10)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-13 19:16:23 +00:00
5b1f1df17a
Merge pull request #101 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.10.9
Bump go.unistack.org/micro/v3 from 3.10.6 to 3.10.9
2023-02-08 21:05:25 +03:00
dependabot[bot]
11d7ee54fd
Bump go.unistack.org/micro/v3 from 3.10.6 to 3.10.9
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.10.6 to 3.10.9.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.10.6...v3.10.9)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-08 18:03:34 +00:00
41d606b4e8
Merge pull request #100 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.10.6
Bump go.unistack.org/micro/v3 from 3.10.5 to 3.10.6
2023-02-06 21:08:51 +03:00
dependabot[bot]
5f6f06c239
Bump go.unistack.org/micro/v3 from 3.10.5 to 3.10.6
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.10.5 to 3.10.6.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.10.5...v3.10.6)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-06 18:06:46 +00:00
dependabot[bot]
f80bb95119
Bump dependabot/fetch-metadata from 1.3.5 to 1.3.6 (#97)
Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.3.5 to 1.3.6.
- [Release notes](https://github.com/dependabot/fetch-metadata/releases)
- [Commits](https://github.com/dependabot/fetch-metadata/compare/v1.3.5...v1.3.6)

---
updated-dependencies:
- dependency-name: dependabot/fetch-metadata
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-30 21:21:22 +03:00
dependabot[bot]
cd23f93d57
Bump golangci/golangci-lint-action from 3.3.1 to 3.4.0 (#96)
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 3.3.1 to 3.4.0.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v3.3.1...v3.4.0)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-30 18:14:03 +00:00
f625d5c958
Merge pull request #98 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.10.5
Bump go.unistack.org/micro/v3 from 3.10.4 to 3.10.5
2023-01-30 21:08:56 +03:00
dependabot[bot]
8b068fb7ab
Bump go.unistack.org/micro/v3 from 3.10.4 to 3.10.5
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.10.4 to 3.10.5.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.10.4...v3.10.5)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-30 18:06:50 +00:00
3a1e9ec707
Merge pull request #95 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.10.4
Bump go.unistack.org/micro/v3 from 3.10.1 to 3.10.4
2023-01-18 21:04:54 +03:00
dependabot[bot]
4d6a98782c
Bump go.unistack.org/micro/v3 from 3.10.1 to 3.10.4
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.10.1 to 3.10.4.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.10.1...v3.10.4)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-18 18:03:06 +00:00
af838ec6e5
Merge pull request #94 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.10.1
Bump go.unistack.org/micro/v3 from 3.10.0 to 3.10.1
2023-01-17 21:05:06 +03:00
dependabot[bot]
0c90ea28d9
Bump go.unistack.org/micro/v3 from 3.10.0 to 3.10.1
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.10.0 to 3.10.1.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.10.0...v3.10.1)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-17 18:03:12 +00:00
90e327726b
Merge pull request #93 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.10.0
Bump go.unistack.org/micro/v3 from 3.9.18 to 3.10.0
2023-01-09 21:21:55 +03:00
dependabot[bot]
6e29ac652b
Bump go.unistack.org/micro/v3 from 3.9.18 to 3.10.0
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.9.18 to 3.10.0.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.9.18...v3.10.0)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-09 18:20:15 +00:00
f8b0fe881f
Merge pull request #92 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.9.18
Bump go.unistack.org/micro/v3 from 3.9.17 to 3.9.18
2022-12-28 21:09:44 +03:00
dependabot[bot]
2941a335f0
Bump go.unistack.org/micro/v3 from 3.9.17 to 3.9.18
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.9.17 to 3.9.18.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.9.17...v3.9.18)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-28 18:07:29 +00:00
712ba79b55
Merge pull request #91 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.9.17
Bump go.unistack.org/micro/v3 from 3.9.15 to 3.9.17
2022-12-26 21:05:49 +03:00
dependabot[bot]
3df3d6bfa3
Bump go.unistack.org/micro/v3 from 3.9.15 to 3.9.17
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.9.15 to 3.9.17.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.9.15...v3.9.17)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-26 18:04:17 +00:00
bed23083cf
Merge pull request #90 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.9.15
Bump go.unistack.org/micro/v3 from 3.9.13 to 3.9.15
2022-11-28 21:08:44 +03:00
dependabot[bot]
79175c96aa
Bump go.unistack.org/micro/v3 from 3.9.13 to 3.9.15
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.9.13 to 3.9.15.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.9.13...v3.9.15)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-28 18:06:45 +00:00
dependabot[bot]
c23192f2b6
Bump hmarr/auto-approve-action from 2 to 3 (#89)
Bumps [hmarr/auto-approve-action](https://github.com/hmarr/auto-approve-action) from 2 to 3.
- [Release notes](https://github.com/hmarr/auto-approve-action/releases)
- [Commits](https://github.com/hmarr/auto-approve-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: hmarr/auto-approve-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-28 16:25:58 +03:00
2bf129d6ab
Merge pull request #88 from unistack-org/ctx_dialer
add context dialer support
2022-11-17 00:06:59 +03:00
4bf60486e0 add context dialer support
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-11-17 00:05:09 +03:00
d048278b84
Merge pull request #87 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.9.13
Bump go.unistack.org/micro/v3 from 3.9.11 to 3.9.13
2022-11-14 21:05:48 +03:00
dependabot[bot]
1cf18ac2a9
Bump go.unistack.org/micro/v3 from 3.9.11 to 3.9.13
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.9.11 to 3.9.13.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.9.11...v3.9.13)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-14 18:03:58 +00:00
dependabot[bot]
251f6f70c4
Bump golangci/golangci-lint-action from 3.2.0 to 3.3.1 (#86)
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 3.2.0 to 3.3.1.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v3.2.0...v3.3.1)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-14 07:22:37 +03:00
dependabot[bot]
26bf526741
Bump dependabot/fetch-metadata from 1.3.4 to 1.3.5 (#85)
Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.3.4 to 1.3.5.
- [Release notes](https://github.com/dependabot/fetch-metadata/releases)
- [Commits](https://github.com/dependabot/fetch-metadata/compare/v1.3.4...v1.3.5)

---
updated-dependencies:
- dependency-name: dependabot/fetch-metadata
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-14 07:04:31 +03:00
dependabot[bot]
a86c824eb7
Bump dependabot/fetch-metadata from 1.3.3 to 1.3.4 (#83)
Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.3.3 to 1.3.4.
- [Release notes](https://github.com/dependabot/fetch-metadata/releases)
- [Commits](https://github.com/dependabot/fetch-metadata/compare/v1.3.3...v1.3.4)

---
updated-dependencies:
- dependency-name: dependabot/fetch-metadata
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-04 11:43:33 +03:00
dependabot[bot]
f8cd67b8cd
Bump dependabot/fetch-metadata from 1.3.1 to 1.3.3 (#81)
Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.3.1 to 1.3.3.
- [Release notes](https://github.com/dependabot/fetch-metadata/releases)
- [Commits](https://github.com/dependabot/fetch-metadata/compare/v1.3.1...v1.3.3)

---
updated-dependencies:
- dependency-name: dependabot/fetch-metadata
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-28 17:45:04 +03:00
feb5fec0dd
Merge pull request #82 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.9.11
Bump go.unistack.org/micro/v3 from 3.9.10 to 3.9.11
2022-07-11 21:20:31 +03:00
dependabot[bot]
37996fbe90
Bump go.unistack.org/micro/v3 from 3.9.10 to 3.9.11
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.9.10 to 3.9.11.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.9.10...v3.9.11)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-11 18:18:37 +00:00
08a22e02f9
Merge pull request #79 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.9.10
Bump go.unistack.org/micro/v3 from 3.9.8 to 3.9.10
2022-06-27 21:40:09 +03:00
dependabot[bot]
3358ce8aa2
Bump go.unistack.org/micro/v3 from 3.9.8 to 3.9.10
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.9.8 to 3.9.10.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.9.8...v3.9.10)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-27 18:38:09 +00:00
dependabot[bot]
74158bd60b
Bump golangci/golangci-lint-action from 3.1.0 to 3.2.0 (#78)
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 3.1.0 to 3.2.0.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v3.1.0...v3.2.0)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-25 22:52:35 +03:00
930530cbae
Merge pull request #77 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.9.8
Bump go.unistack.org/micro/v3 from 3.9.7 to 3.9.8
2022-05-03 21:15:55 +03:00
dependabot[bot]
24a8dbdc4b
Bump go.unistack.org/micro/v3 from 3.9.7 to 3.9.8
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.9.7 to 3.9.8.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.9.7...v3.9.8)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-03 18:14:10 +00:00
c3c580163d
Merge pull request #76 from unistack-org/backoff
use backoff for lookup too
2022-05-01 23:34:28 +03:00
4ad526253a use backoff for lookup too
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-05-01 23:32:37 +03:00
dependabot[bot]
3eca811f81
Bump github/codeql-action from 1 to 2 (#75)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 1 to 2.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v1...v2)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-25 21:44:56 +03:00
dependabot[bot]
367fe6d579
Bump dependabot/fetch-metadata from 1.3.0 to 1.3.1 (#74)
Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.3.0 to 1.3.1.
- [Release notes](https://github.com/dependabot/fetch-metadata/releases)
- [Commits](https://github.com/dependabot/fetch-metadata/compare/v1.3.0...v1.3.1)

---
updated-dependencies:
- dependency-name: dependabot/fetch-metadata
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-21 12:48:37 +03:00
b86a166d08
Merge pull request #73 from unistack-org/dependabot/github_actions/actions/setup-go-3
Bump actions/setup-go from 2 to 3
2022-04-11 22:58:06 +03:00
dependabot[bot]
ecd2711714
Bump actions/setup-go from 2 to 3
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 2 to 3.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-08 18:17:08 +00:00
0e82845989
Merge pull request #72 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.9.7
Bump go.unistack.org/micro/v3 from 3.9.5 to 3.9.7
2022-03-30 21:24:05 +03:00
dependabot[bot]
670a31c9ef
Bump go.unistack.org/micro/v3 from 3.9.5 to 3.9.7
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.9.5 to 3.9.7.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.9.5...v3.9.7)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-30 18:22:04 +00:00
6f136a039b
Merge pull request #71 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.9.5
Bump go.unistack.org/micro/v3 from 3.9.2 to 3.9.5
2022-03-28 21:29:16 +03:00
dependabot[bot]
c8516877ee
Bump go.unistack.org/micro/v3 from 3.9.2 to 3.9.5
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.9.2 to 3.9.5.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.9.2...v3.9.5)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-28 18:27:27 +00:00
2075368ba3
Merge pull request #70 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.9.2
Bump go.unistack.org/micro/v3 from 3.9.1 to 3.9.2
2022-03-25 21:24:30 +03:00
dependabot[bot]
fbef71bae8
Bump go.unistack.org/micro/v3 from 3.9.1 to 3.9.2
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.9.1 to 3.9.2.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.9.1...v3.9.2)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-25 18:23:00 +00:00
a946d63cae
Merge pull request #68 from unistack-org/dependabot/github_actions/actions/cache-3
Bump actions/cache from 2 to 3
2022-03-22 23:14:45 +03:00
dependabot[bot]
bc47181f45
Bump actions/cache from 2 to 3
Bumps [actions/cache](https://github.com/actions/cache) from 2 to 3.
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](https://github.com/actions/cache/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-22 18:33:08 +00:00
e29671add6
Merge pull request #69 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.9.1
Bump go.unistack.org/micro/v3 from 3.9.0 to 3.9.1
2022-03-22 21:32:31 +03:00
dependabot[bot]
dede9e6488
Bump go.unistack.org/micro/v3 from 3.9.0 to 3.9.1
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.9.0 to 3.9.1.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.9.0...v3.9.1)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-22 18:26:02 +00:00
2f658787d4
Merge pull request #67 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.9.0
Bump go.unistack.org/micro/v3 from 3.8.21 to 3.9.0
2022-03-21 21:43:35 +03:00
dependabot[bot]
b8ad04a42a
Bump go.unistack.org/micro/v3 from 3.8.21 to 3.9.0
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.21 to 3.9.0.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.21...v3.9.0)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-21 18:41:56 +00:00
766cbd8ae0
Merge pull request #66 from unistack-org/wrappers
add additional wrappers support
2022-03-10 12:30:10 +03:00
847352a8d3 Merge branch 'master' into wrappers 2022-03-10 12:28:56 +03:00
147c2d756e add additional wrappers support
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-03-10 12:27:37 +03:00
f42994e5c0 update go version
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-03-07 13:45:05 +03:00
08b3e7e23e
Merge pull request #64 from unistack-org/message
add message metadata support
2022-03-05 19:04:45 +03:00
2f70890e6c
Merge branch 'master' into message 2022-03-05 19:02:56 +03:00
e9be505c59 fix workflow
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-03-05 19:02:47 +03:00
13749e7a4d
Merge branch 'master' into message 2022-03-05 19:01:26 +03:00
91cf06abbd fix workflow
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-03-05 19:01:13 +03:00
a1f29249d3
Merge branch 'master' into message 2022-03-05 18:58:02 +03:00
db9c686306 fix workflow
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-03-05 18:57:54 +03:00
b74add18c1
Merge branch 'master' into message 2022-03-05 18:54:53 +03:00
5d3cbfc7d3 fix workflow
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-03-05 18:54:28 +03:00
f42e8883ae
Merge branch 'master' into message 2022-03-05 18:49:30 +03:00
93344a3f7b fix workflow
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-03-05 18:49:01 +03:00
2e218748e8 fix workflow
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-03-05 18:47:38 +03:00
178d68aae9 add message metadata support
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-03-05 18:46:00 +03:00
2061b2dbb6 update worklow
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-03-05 18:45:15 +03:00
fa9e204032 update
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-03-05 18:38:35 +03:00
bce6f8c3e7 fix workflows
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-03-05 18:32:28 +03:00
1ee46a0aac update workflow
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-03-05 18:25:01 +03:00
4f749c5bb1 change workflow
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-03-05 18:20:30 +03:00
8231f4f7f6
Merge pull request #57 from unistack-org/master
merge master
2022-03-03 17:47:50 +03:00
241114aeb1
Merge pull request #56 from unistack-org/fix_exported
fixup for older go
2022-03-03 17:47:30 +03:00
e4541d8b44 fixup for older go
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-03-03 17:47:12 +03:00
b658f5091a
Merge pull request #55 from unistack-org/master
merge master
2022-03-02 17:52:34 +03:00
c21d30e4a0
Merge pull request #52 from unistack-org/dependabot/github_actions/dependabot/fetch-metadata-1.3.0
Bump dependabot/fetch-metadata from 1.2.1 to 1.3.0
2022-03-02 17:52:10 +03:00
1349df4d97
Merge pull request #53 from unistack-org/dependabot/github_actions/actions/checkout-3
Bump actions/checkout from 2 to 3
2022-03-02 17:52:01 +03:00
6dfc8b8a01
Merge pull request #54 from unistack-org/isExported
fixup for unexported fields
2022-03-02 17:51:49 +03:00
d280ea260e fixup for unexported fields
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-03-02 17:51:29 +03:00
dependabot[bot]
e9295b1d12
Bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-01 18:19:22 +00:00
dependabot[bot]
75b102666f
Bump dependabot/fetch-metadata from 1.2.1 to 1.3.0
Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.2.1 to 1.3.0.
- [Release notes](https://github.com/dependabot/fetch-metadata/releases)
- [Commits](https://github.com/dependabot/fetch-metadata/compare/v1.2.1...v1.3.0)

---
updated-dependencies:
- dependency-name: dependabot/fetch-metadata
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-01 18:19:19 +00:00
18b95d7dde
Merge pull request #51 from unistack-org/dependabot/github_actions/golangci/golangci-lint-action-3.1.0
Bump golangci/golangci-lint-action from 2 to 3.1.0
2022-03-01 00:38:46 +03:00
dependabot[bot]
6d3d8ccd14
Bump golangci/golangci-lint-action from 2 to 3.1.0
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 2 to 3.1.0.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v2...v3.1.0)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-28 18:24:50 +00:00
f37c8fd5d4
Merge pull request #49 from unistack-org/dependabot/github_actions/dependabot/fetch-metadata-1.2.1
Bump dependabot/fetch-metadata from 1.1.1 to 1.2.1
2022-02-25 09:41:34 +03:00
dependabot[bot]
c0bfe416b1
Bump dependabot/fetch-metadata from 1.1.1 to 1.2.1
Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.1.1 to 1.2.1.
- [Release notes](https://github.com/dependabot/fetch-metadata/releases)
- [Commits](https://github.com/dependabot/fetch-metadata/compare/v1.1.1...v1.2.1)

---
updated-dependencies:
- dependency-name: dependabot/fetch-metadata
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-23 18:16:56 +00:00
ce520397c4
Merge pull request #47 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.21
Bump go.unistack.org/micro/v3 from 3.8.20 to 3.8.21
2022-01-31 21:22:52 +03:00
dependabot[bot]
3cd4e16c36
Bump go.unistack.org/micro/v3 from 3.8.20 to 3.8.21
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.20 to 3.8.21.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.20...v3.8.21)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-31 18:21:09 +00:00
3dccbcba98
Merge pull request #46 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.20
Bump go.unistack.org/micro/v3 from 3.8.19 to 3.8.20
2022-01-26 21:17:26 +03:00
dependabot[bot]
7572ef631d
Bump go.unistack.org/micro/v3 from 3.8.19 to 3.8.20
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.19 to 3.8.20.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.19...v3.8.20)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-26 18:15:32 +00:00
030d906f87
Merge pull request #45 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.19
Bump go.unistack.org/micro/v3 from 3.8.18 to 3.8.19
2022-01-25 21:17:30 +03:00
dependabot[bot]
bfefab250f
Bump go.unistack.org/micro/v3 from 3.8.18 to 3.8.19
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.18 to 3.8.19.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.18...v3.8.19)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-25 18:15:35 +00:00
82b7b5e4fb
Merge pull request #44 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.18
Bump go.unistack.org/micro/v3 from 3.8.15 to 3.8.18
2022-01-21 21:21:18 +03:00
dependabot[bot]
980bea6e4f
Bump go.unistack.org/micro/v3 from 3.8.15 to 3.8.18
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.15 to 3.8.18.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.15...v3.8.18)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-21 18:19:33 +00:00
a7ce52d564
Merge pull request #43 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.15
Bump go.unistack.org/micro/v3 from 3.8.14 to 3.8.15
2022-01-19 21:19:09 +03:00
dependabot[bot]
4771d5e12b
Bump go.unistack.org/micro/v3 from 3.8.14 to 3.8.15
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.14 to 3.8.15.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.14...v3.8.15)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-19 18:17:23 +00:00
6be01f2cb2 Merge branch 'master' into v3 2022-01-12 17:48:26 +03:00
3829766afd update for latest micro
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-01-12 17:47:58 +03:00
a2939066a5
Merge pull request #41 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.13
Bump go.unistack.org/micro/v3 from 3.8.12 to 3.8.13
2021-12-28 21:16:44 +03:00
dependabot[bot]
e6718f368a
Bump go.unistack.org/micro/v3 from 3.8.12 to 3.8.13
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.12 to 3.8.13.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.12...v3.8.13)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-28 18:15:08 +00:00
381f3e051e
Merge pull request #40 from unistack-org/master
merge master
2021-12-16 15:38:33 +03:00
757c458f60 fix for latest micro
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-12-16 15:37:49 +03:00
a2f089f890
Merge pull request #39 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.11
Bump go.unistack.org/micro/v3 from 3.8.10 to 3.8.11
2021-11-24 21:19:29 +03:00
dependabot[bot]
d85e3fdce2
Bump go.unistack.org/micro/v3 from 3.8.10 to 3.8.11
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.10 to 3.8.11.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.10...v3.8.11)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-24 18:17:26 +00:00
5f370d1a31
Merge pull request #38 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.10
Bump go.unistack.org/micro/v3 from 3.8.9 to 3.8.10
2021-11-19 21:17:58 +03:00
dependabot[bot]
2b47343e07
Bump go.unistack.org/micro/v3 from 3.8.9 to 3.8.10
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.9 to 3.8.10.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.9...v3.8.10)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-19 18:16:11 +00:00
00c1d3618f
Merge pull request #37 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.9
Bump go.unistack.org/micro/v3 from 3.8.7 to 3.8.9
2021-11-18 21:23:11 +03:00
dependabot[bot]
0f80c9f7ba
Bump go.unistack.org/micro/v3 from 3.8.7 to 3.8.9
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.7 to 3.8.9.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.7...v3.8.9)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-18 18:21:19 +00:00
a275ffa001
Merge pull request #36 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.7
Bump go.unistack.org/micro/v3 from 3.8.6 to 3.8.7
2021-10-28 21:22:57 +03:00
dependabot[bot]
2800d4c78b
Bump go.unistack.org/micro/v3 from 3.8.6 to 3.8.7
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.6 to 3.8.7.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.6...v3.8.7)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-28 18:21:01 +00:00
a609f15425
Merge pull request #35 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.6
Bump go.unistack.org/micro/v3 from 3.8.5 to 3.8.6
2021-10-27 16:34:53 +03:00
dependabot[bot]
83cc922771
Bump go.unistack.org/micro/v3 from 3.8.5 to 3.8.6
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.5 to 3.8.6.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.5...v3.8.6)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-27 13:29:38 +00:00
2bba395ba3 fixup
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-10-27 16:28:34 +03:00
a360ef0e8f fixup
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-10-27 16:25:28 +03:00
5f0e4915f6 fixup
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-10-27 16:18:11 +03:00
f02efaf18c fixup
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-10-27 16:08:18 +03:00
279d111d39 fixup
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-10-27 16:07:12 +03:00
928455a651 fixup
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-10-27 15:56:36 +03:00
6df77d317d update automerge 2021-10-27 15:56:06 +03:00
e8f7fab079 Merge branch 'v3' 2021-10-27 15:49:00 +03:00
ae6f29e540 update
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-10-27 15:44:35 +03:00
de6cdb4e4d update
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-10-27 15:37:42 +03:00
0398d969d5 github automerge
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-10-27 15:37:42 +03:00
10419bc74a github automerge
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-10-27 15:37:42 +03:00
93ce60f59c fix Header and Cookie fill
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-10-27 15:37:42 +03:00
61c082cb2f github automerge
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-10-27 15:24:55 +03:00
22f1b6551a github automerge
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-10-27 15:23:26 +03:00
73b7d998c0 fix Header and Cookie fill
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-10-27 13:13:33 +03:00
4aca8e1ce0
merge v3 branch (#34)
* guard import

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* Bump go.unistack.org/micro/v3 from 3.8.4 to 3.8.5 (#32)

Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.4 to 3.8.5.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.4...v3.8.5)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-26 19:01:46 +00:00
3592052ac9 guard import
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-10-25 20:35:02 +03:00
fd5479f6e7 add ability to send headers and cookies
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-10-25 19:59:37 +03:00
4fe11b430e fix path query requests with templates
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-09-23 08:58:55 +03:00
5dc57579c3 update workflow
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-09-21 21:46:43 +03:00
dependabot[bot]
f974460ff3
Bump github.com/unistack-org/micro/v3 from 3.7.0 to 3.7.1 (#28)
Bumps [github.com/unistack-org/micro/v3](https://github.com/unistack-org/micro) from 3.7.0 to 3.7.1.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.7.0...v3.7.1)

---
updated-dependencies:
- dependency-name: github.com/unistack-org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-09-17 08:27:55 +03:00
5c54b82aaf fixup workflow
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-09-17 08:22:44 +03:00
a5bf3e2edc update workflows
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-09-17 07:47:48 +03:00
3a2bac8723 enable automerge
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-09-16 11:03:10 +03:00
dependabot[bot]
9a72dba9df
Bump github.com/unistack-org/micro/v3 from 3.6.2 to 3.7.0 (#27) 2021-09-06 15:03:55 +00:00
00e853e3ee add github stuff
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-09-06 15:23:36 +03:00
5aff0014bb add github stuff
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-09-06 10:32:59 +03:00
807b4dc41a fix for url query params in url
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-09-01 02:25:29 +03:00
a1f432fac9 fix parsing of url query with all methods
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-09-01 02:06:01 +03:00
dd7e872858 update micro
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-08-17 01:23:04 +03:00
57c2a5b95f nolint
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-07-31 15:01:44 +03:00
73fc3d34f0 minor tweaks
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-07-31 14:59:09 +03:00
19 changed files with 692 additions and 351 deletions

19
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,19 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
# Maintain dependencies for Golang
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"

20
.github/renovate.json vendored
View File

@ -1,20 +0,0 @@
{
"extends": [
"config:base"
],
"postUpdateOptions": ["gomodTidy"],
"packageRules": [
{
"matchUpdateTypes": ["minor", "patch", "pin", "digest"],
"automerge": true
},
{
"groupName": "all deps",
"separateMajorMinor": true,
"groupSlug": "all",
"packagePatterns": [
"*"
]
}
]
}

20
.github/workflows/autoapprove.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: "autoapprove"
on:
pull_request_target:
types: [assigned, opened, synchronize, reopened]
permissions:
pull-requests: write
contents: write
jobs:
autoapprove:
runs-on: ubuntu-latest
steps:
- name: approve
uses: hmarr/auto-approve-action@v3
if: github.actor == 'vtolstov' || github.actor == 'dependabot[bot]'
id: approve
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

21
.github/workflows/automerge.yml vendored Normal file
View File

@ -0,0 +1,21 @@
name: "automerge"
on:
pull_request_target:
types: [assigned, opened, synchronize, reopened]
permissions:
pull-requests: write
contents: write
jobs:
automerge:
runs-on: ubuntu-latest
if: github.actor == 'vtolstov'
steps:
- name: merge
id: merge
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.TOKEN}}

View File

@ -3,19 +3,20 @@ on:
push: push:
branches: branches:
- master - master
- v3
jobs: jobs:
test: test:
name: test name: test
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: setup - name: setup
uses: actions/setup-go@v2 uses: actions/setup-go@v3
with: with:
go-version: 1.16 go-version: 1.17
- name: checkout - name: checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: cache - name: cache
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: ~/go/pkg/mod path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
@ -31,12 +32,13 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: checkout - name: checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: lint - name: lint
uses: golangci/golangci-lint-action@v2 uses: golangci/golangci-lint-action@v3.4.0
continue-on-error: true
with: with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.39 version: v1.30
# Optional: working directory, useful for monorepos # Optional: working directory, useful for monorepos
# working-directory: somedir # working-directory: somedir
# Optional: golangci-lint command line arguments. # Optional: golangci-lint command line arguments.

78
.github/workflows/codeql-analysis.yml vendored Normal file
View File

@ -0,0 +1,78 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "codeql"
on:
workflow_run:
workflows: ["prbuild"]
types:
- completed
push:
branches: [ master, v3 ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master, v3 ]
schedule:
- cron: '34 1 * * 0'
jobs:
analyze:
name: analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'go' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
steps:
- name: checkout
uses: actions/checkout@v3
- name: setup
uses: actions/setup-go@v3
with:
go-version: 1.17
# Initializes the CodeQL tools for scanning.
- name: init
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: autobuild
uses: github/codeql-action/autobuild@v2
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: analyze
uses: github/codeql-action/analyze@v2

View File

@ -0,0 +1,27 @@
name: "dependabot-automerge"
on:
pull_request_target:
types: [assigned, opened, synchronize, reopened]
permissions:
pull-requests: write
contents: write
jobs:
automerge:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- name: metadata
id: metadata
uses: dependabot/fetch-metadata@v1.3.6
with:
github-token: "${{ secrets.TOKEN }}"
- name: merge
id: merge
if: ${{contains(steps.metadata.outputs.dependency-names, 'go.unistack.org')}}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.TOKEN}}

View File

@ -3,19 +3,20 @@ on:
pull_request: pull_request:
branches: branches:
- master - master
- v3
jobs: jobs:
test: test:
name: test name: test
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: setup - name: setup
uses: actions/setup-go@v2 uses: actions/setup-go@v3
with: with:
go-version: 1.16 go-version: 1.17
- name: checkout - name: checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: cache - name: cache
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: ~/go/pkg/mod path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
@ -31,12 +32,13 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: checkout - name: checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: lint - name: lint
uses: golangci/golangci-lint-action@v2 uses: golangci/golangci-lint-action@v3.4.0
continue-on-error: true
with: with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.39 version: v1.30
# Optional: working directory, useful for monorepos # Optional: working directory, useful for monorepos
# working-directory: somedir # working-directory: somedir
# Optional: golangci-lint command line arguments. # Optional: golangci-lint command line arguments.

View File

@ -5,14 +5,14 @@ This plugin is a http client for micro.
## Overview ## Overview
The http client wraps `net/http` to provide a robust micro client with service discovery, load balancing and streaming. The http client wraps `net/http` to provide a robust micro client with service discovery, load balancing and streaming.
It complies with the [micro.Client](https://godoc.org/github.com/unistack-org/micro-client-http#Client) interface. It complies with the [micro.Client](https://godoc.org/go.unistack.org/micro-client-http/v4#Client) interface.
## Usage ## Usage
### Use directly ### Use directly
```go ```go
import "github.com/unistack-org/micro-client-http" import "go.unistack.org/micro-client-http/v4"
service := micro.NewService( service := micro.NewService(
micro.Name("my.service"), micro.Name("my.service"),

6
go.mod
View File

@ -1,5 +1,5 @@
module github.com/unistack-org/micro-client-http/v3 module go.unistack.org/micro-client-http/v4
go 1.16 go 1.19
require github.com/unistack-org/micro/v3 v3.5.4 require go.unistack.org/micro/v4 v4.0.18

23
go.sum
View File

@ -1,17 +1,6 @@
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= go.unistack.org/micro/v4 v4.0.1 h1:xo1IxbVfgh8i0eY0VeYa3cbb13u5n/Mxnp3FOgWD4Jo=
github.com/ef-ds/deque v1.0.4/go.mod h1:gXDnTC3yqvBcHbq2lcExjtAcVrOnJCbMcZXmuj8Z4tg= go.unistack.org/micro/v4 v4.0.1/go.mod h1:p/J5UcSJjfHsWGT31uKoghQ5rUQZzQJBAFy+Z4+ZVMs=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= go.unistack.org/micro/v4 v4.0.6 h1:YFWvTh3VwyOd6NHYTQcf47n2TF5+p/EhpnbuBQX3qhk=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= go.unistack.org/micro/v4 v4.0.6/go.mod h1:bVEYTlPi0EsdgZZt311bIroDg9ict7ky3C87dSCCAGk=
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= go.unistack.org/micro/v4 v4.0.18 h1:b7WFwem8Nz1xBrRg5FeLnm9CE5gJseHyf9j0BhkiXW0=
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= go.unistack.org/micro/v4 v4.0.18/go.mod h1:5+da5r835gP0WnNZbYUJDCvWpJ9Xc3IEGyp62e8o8R4=
github.com/silas/dag v0.0.0-20210121180416-41cf55125c34/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I=
github.com/unistack-org/micro/v3 v3.5.4 h1:6nIljqND355f+Fhc2mtCxYb5IRwer6nsMoAXpN8kka0=
github.com/unistack-org/micro/v3 v3.5.4/go.mod h1:1ZkwpEqpiHiVhM2hiF9DamtpsF04oFybFhEQ4zEMcro=
golang.org/x/net v0.0.0-20210510120150-4163338589ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

339
http.go
View File

@ -1,5 +1,5 @@
// Package http provides a http client // Package http provides a http client
package http package http // import "go.unistack.org/micro-client-http/v4"
import ( import (
"bufio" "bufio"
@ -10,16 +10,18 @@ import (
"net" "net"
"net/http" "net/http"
"net/url" "net/url"
"os"
"strings" "strings"
"sync" "sync"
"time" "time"
"github.com/unistack-org/micro/v3/broker" "go.unistack.org/micro/v4/client"
"github.com/unistack-org/micro/v3/client" "go.unistack.org/micro/v4/codec"
"github.com/unistack-org/micro/v3/codec" "go.unistack.org/micro/v4/errors"
"github.com/unistack-org/micro/v3/errors" "go.unistack.org/micro/v4/logger"
"github.com/unistack-org/micro/v3/metadata" "go.unistack.org/micro/v4/metadata"
"go.unistack.org/micro/v4/options"
"go.unistack.org/micro/v4/selector"
rutil "go.unistack.org/micro/v4/util/reflect"
) )
var DefaultContentType = "application/json" var DefaultContentType = "application/json"
@ -38,8 +40,9 @@ type httpClient struct {
init bool init bool
} }
func newRequest(ctx context.Context, addr string, req client.Request, ct string, cf codec.Codec, msg interface{}, opts client.CallOptions) (*http.Request, error) { func newRequest(ctx context.Context, log logger.Logger, addr string, req client.Request, ct string, cf codec.Codec, msg interface{}, opts client.CallOptions) (*http.Request, error) {
var tags []string var tags []string
var parameters map[string]map[string]string
scheme := "http" scheme := "http"
method := http.MethodPost method := http.MethodPost
body := "*" // as like google api http annotation body := "*" // as like google api http annotation
@ -55,6 +58,7 @@ func newRequest(ctx context.Context, addr string, req client.Request, ct string,
u = &url.URL{Scheme: scheme, Path: path, Host: host} u = &url.URL{Scheme: scheme, Path: path, Host: host}
} }
// nolint: nestif
if opts.Context != nil { if opts.Context != nil {
if m, ok := opts.Context.Value(methodKey{}).(string); ok { if m, ok := opts.Context.Value(methodKey{}).(string); ok {
method = m method = m
@ -68,6 +72,32 @@ func newRequest(ctx context.Context, addr string, req client.Request, ct string,
if t, ok := opts.Context.Value(structTagsKey{}).([]string); ok && len(t) > 0 { if t, ok := opts.Context.Value(structTagsKey{}).([]string); ok && len(t) > 0 {
tags = t tags = t
} }
if k, ok := opts.Context.Value(headerKey{}).([]string); ok && len(k) > 0 {
if parameters == nil {
parameters = make(map[string]map[string]string)
}
m, ok := parameters["header"]
if !ok {
m = make(map[string]string)
parameters["header"] = m
}
for idx := 0; idx < len(k)/2; idx += 2 {
m[k[idx]] = k[idx+1]
}
}
if k, ok := opts.Context.Value(cookieKey{}).([]string); ok && len(k) > 0 {
if parameters == nil {
parameters = make(map[string]map[string]string)
}
m, ok := parameters["cookie"]
if !ok {
m = make(map[string]string)
parameters["cookie"] = m
}
for idx := 0; idx < len(k)/2; idx += 2 {
m[k[idx]] = k[idx+1]
}
}
} }
if len(tags) == 0 { if len(tags) == 0 {
@ -88,7 +118,13 @@ func newRequest(ctx context.Context, addr string, req client.Request, ct string,
return nil, errors.BadRequest("go.micro.client", err.Error()) return nil, errors.BadRequest("go.micro.client", err.Error())
} }
path, nmsg, err := newPathRequest(u.Path, method, body, msg, tags) var nmsg interface{}
if len(u.Query()) > 0 {
path, nmsg, err = newPathRequest(u.Path+"?"+u.RawQuery, method, body, msg, tags, parameters)
} else {
path, nmsg, err = newPathRequest(u.Path, method, body, msg, tags, parameters)
}
if err != nil { if err != nil {
return nil, errors.BadRequest("go.micro.client", err.Error()) return nil, errors.BadRequest("go.micro.client", err.Error())
} }
@ -98,6 +134,64 @@ func newRequest(ctx context.Context, addr string, req client.Request, ct string,
return nil, errors.BadRequest("go.micro.client", err.Error()) return nil, errors.BadRequest("go.micro.client", err.Error())
} }
var cookies []*http.Cookie
header := make(http.Header)
if opts.Context != nil {
if md, ok := opts.Context.Value(metadataKey{}).(metadata.Metadata); ok {
for k, v := range md {
header[k] = v
}
}
}
if opts.AuthToken != "" {
header.Set(metadata.HeaderAuthorization, opts.AuthToken)
}
if opts.RequestMetadata != nil {
for k, v := range opts.RequestMetadata {
header[k] = v
}
}
if md, ok := metadata.FromOutgoingContext(ctx); ok {
for k, v := range md {
header[k] = v
}
}
// set timeout in nanoseconds
if opts.StreamTimeout > time.Duration(0) {
header.Set(metadata.HeaderTimeout, fmt.Sprintf("%d", opts.StreamTimeout))
}
if opts.RequestTimeout > time.Duration(0) {
header.Set(metadata.HeaderTimeout, fmt.Sprintf("%d", opts.RequestTimeout))
}
// set the content type for the request
header.Set(metadata.HeaderContentType, ct)
var v interface{}
for km, vm := range parameters {
for k, required := range vm {
v, err = rutil.StructFieldByPath(msg, k)
if err != nil {
return nil, errors.BadRequest("go.micro.client", err.Error())
}
if rutil.IsZero(v) {
if required == "true" {
return nil, errors.BadRequest("go.micro.client", fmt.Sprintf("required field %s not set", k))
}
continue
}
switch km {
case "header":
header.Set(k, fmt.Sprintf("%v", v))
case "cookie":
cookies = append(cookies, &http.Cookie{Name: k, Value: fmt.Sprintf("%v", v)})
}
}
}
b, err := cf.Marshal(nmsg) b, err := cf.Marshal(nmsg)
if err != nil { if err != nil {
return nil, errors.BadRequest("go.micro.client", err.Error()) return nil, errors.BadRequest("go.micro.client", err.Error())
@ -107,6 +201,7 @@ func newRequest(ctx context.Context, addr string, req client.Request, ct string,
if len(b) > 0 { if len(b) > 0 {
hreq, err = http.NewRequestWithContext(ctx, method, u.String(), ioutil.NopCloser(bytes.NewBuffer(b))) hreq, err = http.NewRequestWithContext(ctx, method, u.String(), ioutil.NopCloser(bytes.NewBuffer(b)))
hreq.ContentLength = int64(len(b)) hreq.ContentLength = int64(len(b))
header.Set("Content-Length", fmt.Sprintf("%d", hreq.ContentLength))
} else { } else {
hreq, err = http.NewRequestWithContext(ctx, method, u.String(), nil) hreq, err = http.NewRequestWithContext(ctx, method, u.String(), nil)
} }
@ -115,37 +210,15 @@ func newRequest(ctx context.Context, addr string, req client.Request, ct string,
return nil, errors.BadRequest("go.micro.client", err.Error()) return nil, errors.BadRequest("go.micro.client", err.Error())
} }
header := make(http.Header) hreq.Header = header
for _, cookie := range cookies {
if opts.Context != nil { hreq.AddCookie(cookie)
if md, ok := opts.Context.Value(metadataKey{}).(metadata.Metadata); ok {
for k, v := range md {
header.Set(k, v)
}
}
} }
if opts.AuthToken != "" { if log.V(logger.DebugLevel) {
hreq.Header.Set(metadata.HeaderAuthorization, opts.AuthToken) log.Debug(ctx, fmt.Sprintf("request %s to %s with headers %v body %s", method, u.String(), hreq.Header, b))
} }
if md, ok := metadata.FromOutgoingContext(ctx); ok {
for k, v := range md {
hreq.Header.Set(k, v)
}
}
// set timeout in nanoseconds
if opts.StreamTimeout > time.Duration(0) {
hreq.Header.Set(metadata.HeaderTimeout, fmt.Sprintf("%d", opts.StreamTimeout))
}
if opts.RequestTimeout > time.Duration(0) {
hreq.Header.Set(metadata.HeaderTimeout, fmt.Sprintf("%d", opts.RequestTimeout))
}
// set the content type for the request
hreq.Header.Set(metadata.HeaderContentType, ct)
return hreq, nil return hreq, nil
} }
@ -157,9 +230,9 @@ func (h *httpClient) call(ctx context.Context, addr string, req client.Request,
cf, err := h.newCodec(ct) cf, err := h.newCodec(ct)
if err != nil { if err != nil {
return errors.InternalServerError("go.micro.client", err.Error()) return errors.BadRequest("go.micro.client", err.Error())
} }
hreq, err := newRequest(ctx, addr, req, ct, cf, req.Body(), opts) hreq, err := newRequest(ctx, h.opts.Logger, addr, req, ct, cf, req.Body(), opts)
if err != nil { if err != nil {
return err return err
} }
@ -194,7 +267,7 @@ func (h *httpClient) stream(ctx context.Context, addr string, req client.Request
// get codec // get codec
cf, err := h.newCodec(ct) cf, err := h.newCodec(ct)
if err != nil { if err != nil {
return nil, errors.InternalServerError("go.micro.client", err.Error()) return nil, errors.BadRequest("go.micro.client", err.Error())
} }
cc, err := (h.httpcli.Transport).(*http.Transport).DialContext(ctx, "tcp", addr) cc, err := (h.httpcli.Transport).(*http.Transport).DialContext(ctx, "tcp", addr)
@ -204,6 +277,7 @@ func (h *httpClient) stream(ctx context.Context, addr string, req client.Request
return &httpStream{ return &httpStream{
address: addr, address: addr,
logger: h.opts.Logger,
context: ctx, context: ctx,
closed: make(chan bool), closed: make(chan bool),
opts: opts, opts: opts,
@ -230,7 +304,7 @@ func (h *httpClient) newCodec(ct string) (codec.Codec, error) {
return nil, codec.ErrUnknownContentType return nil, codec.ErrUnknownContentType
} }
func (h *httpClient) Init(opts ...client.Option) error { func (h *httpClient) Init(opts ...options.Option) error {
if len(opts) == 0 && h.init { if len(opts) == 0 && h.init {
return nil return nil
} }
@ -238,9 +312,6 @@ func (h *httpClient) Init(opts ...client.Option) error {
o(&h.opts) o(&h.opts)
} }
if err := h.opts.Broker.Init(); err != nil {
return err
}
if err := h.opts.Tracer.Init(); err != nil { if err := h.opts.Tracer.Init(); err != nil {
return err return err
} }
@ -253,9 +324,6 @@ func (h *httpClient) Init(opts ...client.Option) error {
if err := h.opts.Meter.Init(); err != nil { if err := h.opts.Meter.Init(); err != nil {
return err return err
} }
if err := h.opts.Transport.Init(); err != nil {
return err
}
return nil return nil
} }
@ -264,15 +332,11 @@ func (h *httpClient) Options() client.Options {
return h.opts return h.opts
} }
func (h *httpClient) NewMessage(topic string, msg interface{}, opts ...client.MessageOption) client.Message { func (h *httpClient) NewRequest(service, method string, req interface{}, opts ...options.Option) client.Request {
return newHTTPMessage(topic, msg, h.opts.ContentType, opts...)
}
func (h *httpClient) NewRequest(service, method string, req interface{}, opts ...client.RequestOption) client.Request {
return newHTTPRequest(service, method, req, h.opts.ContentType, opts...) return newHTTPRequest(service, method, req, h.opts.ContentType, opts...)
} }
func (h *httpClient) Call(ctx context.Context, req client.Request, rsp interface{}, opts ...client.CallOption) error { func (h *httpClient) Call(ctx context.Context, req client.Request, rsp interface{}, opts ...options.Option) error {
// make a copy of call opts // make a copy of call opts
callOpts := h.opts.CallOptions callOpts := h.opts.CallOptions
for _, opt := range opts { for _, opt := range opts {
@ -289,8 +353,9 @@ func (h *httpClient) Call(ctx context.Context, req client.Request, rsp interface
} else { } else {
// got a deadline so no need to setup context // got a deadline so no need to setup context
// but we need to set the timeout we pass along // but we need to set the timeout we pass along
opt := client.WithRequestTimeout(time.Until(d)) if err := options.Set(&callOpts, time.Until(d), ".RequestTimeout"); err != nil {
opt(&callOpts) return errors.New("go.micro.client", fmt.Sprintf("%v", err.Error()), 400)
}
} }
// should we noop right here? // should we noop right here?
@ -304,9 +369,9 @@ func (h *httpClient) Call(ctx context.Context, req client.Request, rsp interface
hcall := h.call hcall := h.call
// wrap the call in reverse // wrap the call in reverse
for i := len(callOpts.CallWrappers); i > 0; i-- { //for i := len(callOpts.CallWrappers); i > 0; i-- {
hcall = callOpts.CallWrappers[i-1](hcall) // hcall = callOpts.CallWrappers[i-1](hcall)
} //}
// use the router passed as a call option, or fallback to the rpc clients router // use the router passed as a call option, or fallback to the rpc clients router
if callOpts.Router == nil { if callOpts.Router == nil {
@ -323,18 +388,7 @@ func (h *httpClient) Call(ctx context.Context, req client.Request, rsp interface
callOpts.Address = []string{h.opts.Proxy} callOpts.Address = []string{h.opts.Proxy}
} }
// lookup the route to send the reques to var next selector.Next
// TODO apply any filtering here
routes, err := h.opts.Lookup(ctx, req, callOpts)
if err != nil {
return errors.InternalServerError("go.micro.client", err.Error())
}
// balance the list of nodes
next, err := callOpts.Selector.Select(routes)
if err != nil {
return err
}
// return errors.New("go.micro.client", "request timeout", 408) // return errors.New("go.micro.client", "request timeout", 408)
call := func(i int) error { call := func(i int) error {
@ -349,6 +403,22 @@ func (h *httpClient) Call(ctx context.Context, req client.Request, rsp interface
time.Sleep(t) time.Sleep(t)
} }
if next == nil {
var routes []string
// lookup the route to send the reques to
// TODO apply any filtering here
routes, err = h.opts.Lookup(ctx, req, callOpts)
if err != nil {
return errors.InternalServerError("go.micro.client", err.Error())
}
// balance the list of nodes
next, err = callOpts.Selector.Select(routes)
if err != nil {
return err
}
}
node := next() node := next()
// make the call // make the call
@ -399,7 +469,9 @@ func (h *httpClient) Call(ctx context.Context, req client.Request, rsp interface
return gerr return gerr
} }
func (h *httpClient) Stream(ctx context.Context, req client.Request, opts ...client.CallOption) (client.Stream, error) { func (h *httpClient) Stream(ctx context.Context, req client.Request, opts ...options.Option) (client.Stream, error) {
var err error
// make a copy of call opts // make a copy of call opts
callOpts := h.opts.CallOptions callOpts := h.opts.CallOptions
for _, o := range opts { for _, o := range opts {
@ -416,8 +488,9 @@ func (h *httpClient) Stream(ctx context.Context, req client.Request, opts ...cli
} else { } else {
// got a deadline so no need to setup context // got a deadline so no need to setup context
// but we need to set the timeout we pass along // but we need to set the timeout we pass along
o := client.WithStreamTimeout(time.Until(d)) if err = options.Set(&callOpts, time.Until(d), ".StreamTimeout"); err != nil {
o(&callOpts) return nil, errors.New("go.micro.client", fmt.Sprintf("%v", err.Error()), 400)
}
} }
// should we noop right here? // should we noop right here?
@ -451,18 +524,7 @@ func (h *httpClient) Stream(ctx context.Context, req client.Request, opts ...cli
callOpts.Address = []string{h.opts.Proxy} callOpts.Address = []string{h.opts.Proxy}
} }
// lookup the route to send the reques to var next selector.Next
// TODO apply any filtering here
routes, err := h.opts.Lookup(ctx, req, callOpts)
if err != nil {
return nil, errors.InternalServerError("go.micro.client", err.Error())
}
// balance the list of nodes
next, err := callOpts.Selector.Select(routes)
if err != nil {
return nil, err
}
call := func(i int) (client.Stream, error) { call := func(i int) (client.Stream, error) {
// call backoff first. Someone may want an initial start delay // call backoff first. Someone may want an initial start delay
@ -476,6 +538,22 @@ func (h *httpClient) Stream(ctx context.Context, req client.Request, opts ...cli
time.Sleep(t) time.Sleep(t)
} }
if next == nil {
var routes []string
// lookup the route to send the reques to
// TODO apply any filtering here
routes, err = h.opts.Lookup(ctx, req, callOpts)
if err != nil {
return nil, errors.InternalServerError("go.micro.client", err.Error())
}
// balance the list of nodes
next, err = callOpts.Selector.Select(routes)
if err != nil {
return nil, err
}
}
node := next() node := next()
stream, cerr := h.stream(ctx, node, req, callOpts) stream, cerr := h.stream(ctx, node, req, callOpts)
@ -532,66 +610,6 @@ func (h *httpClient) Stream(ctx context.Context, req client.Request, opts ...cli
return nil, grr return nil, grr
} }
func (h *httpClient) BatchPublish(ctx context.Context, p []client.Message, opts ...client.PublishOption) error {
return h.publish(ctx, p, opts...)
}
func (h *httpClient) Publish(ctx context.Context, p client.Message, opts ...client.PublishOption) error {
return h.publish(ctx, []client.Message{p}, opts...)
}
func (h *httpClient) publish(ctx context.Context, ps []client.Message, opts ...client.PublishOption) error {
options := client.NewPublishOptions(opts...)
// get proxy
exchange := ""
if v, ok := os.LookupEnv("MICRO_PROXY"); ok {
exchange = v
}
msgs := make([]*broker.Message, 0, len(ps))
for _, p := range ps {
md, ok := metadata.FromOutgoingContext(ctx)
if !ok {
md = metadata.New(2)
}
md[metadata.HeaderContentType] = p.ContentType()
md[metadata.HeaderTopic] = p.Topic()
cf, err := h.newCodec(p.ContentType())
if err != nil {
return errors.InternalServerError("go.micro.client", err.Error())
}
var body []byte
// passed in raw data
if d, ok := p.Payload().(*codec.Frame); ok {
body = d.Data
} else {
b := bytes.NewBuffer(nil)
if err := cf.Write(b, &codec.Message{Type: codec.Event}, p.Payload()); err != nil {
return errors.InternalServerError("go.micro.client", err.Error())
}
body = b.Bytes()
}
topic := p.Topic()
if len(exchange) > 0 {
topic = exchange
}
md.Set(metadata.HeaderTopic, topic)
msgs = append(msgs, &broker.Message{Header: md, Body: body})
}
return h.opts.Broker.BatchPublish(ctx, msgs,
broker.PublishContext(ctx),
broker.PublishBodyOnly(options.BodyOnly),
)
}
func (h *httpClient) String() string { func (h *httpClient) String() string {
return "http" return "http"
} }
@ -600,7 +618,7 @@ func (h *httpClient) Name() string {
return h.opts.Name return h.opts.Name
} }
func NewClient(opts ...client.Option) client.Client { func NewClient(opts ...options.Option) client.Client {
options := client.NewOptions(opts...) options := client.NewOptions(opts...)
if len(options.ContentType) == 0 { if len(options.ContentType) == 0 {
@ -611,11 +629,21 @@ func NewClient(opts ...client.Option) client.Client {
opts: options, opts: options,
} }
dialer, ok := options.Context.Value(httpDialerKey{}).(*net.Dialer) var dialer func(context.Context, string) (net.Conn, error)
if !ok { if v, ok := options.Context.Value(httpDialerKey{}).(*net.Dialer); ok {
dialer = &net.Dialer{ dialer = func(ctx context.Context, addr string) (net.Conn, error) {
Timeout: 30 * time.Second, return v.DialContext(ctx, "tcp", addr)
KeepAlive: 30 * time.Second, }
}
if options.ContextDialer != nil {
dialer = options.ContextDialer
}
if dialer == nil {
dialer = func(ctx context.Context, addr string) (net.Conn, error) {
return (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
}).DialContext(ctx, "tcp", addr)
} }
} }
@ -624,8 +652,10 @@ func NewClient(opts ...client.Option) client.Client {
} else { } else {
// TODO customTransport := http.DefaultTransport.(*http.Transport).Clone() // TODO customTransport := http.DefaultTransport.(*http.Transport).Clone()
tr := &http.Transport{ tr := &http.Transport{
Proxy: http.ProxyFromEnvironment, Proxy: http.ProxyFromEnvironment,
DialContext: dialer.DialContext, DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
return dialer(ctx, addr)
},
ForceAttemptHTTP2: true, ForceAttemptHTTP2: true,
MaxConnsPerHost: 100, MaxConnsPerHost: 100,
MaxIdleConns: 20, MaxIdleConns: 20,
@ -638,10 +668,5 @@ func NewClient(opts ...client.Option) client.Client {
} }
c := client.Client(rc) c := client.Client(rc)
// wrap in reverse
for i := len(options.Wrappers); i > 0; i-- {
c = options.Wrappers[i-1](c)
}
return c return c
} }

View File

@ -7,15 +7,57 @@ import (
) )
type Request struct { type Request struct {
Name string `json:"name"` Name string `json:"name"`
Field1 string Field1 string `json:"field1"`
Field2 string ClientID string
Field3 int64 Field2 string
Field3 int64
}
func TestPathWithHeader(t *testing.T) {
req := &Request{Name: "vtolstov", Field1: "field1", ClientID: "1234567890"}
p, m, err := newPathRequest(
"/api/v1/test?Name={name}&Field1={field1}",
"POST",
"*",
req,
nil,
map[string]map[string]string{"header": {"ClientID": "true"}},
)
if err != nil {
t.Fatal(err)
}
u, err := url.Parse(p)
if err != nil {
t.Fatal(err)
}
if m != nil {
t.Fatal("new struct must be nil")
}
if u.Query().Get("Name") != "vtolstov" || u.Query().Get("Field1") != "field1" {
t.Fatalf("invalid values %v", u.Query())
}
}
func TestPathValues(t *testing.T) {
req := &Request{Name: "vtolstov", Field1: "field1"}
p, m, err := newPathRequest("/api/v1/test?Name={name}&Field1={field1}", "POST", "*", req, nil, nil)
if err != nil {
t.Fatal(err)
}
u, err := url.Parse(p)
if err != nil {
t.Fatal(err)
}
_ = m
if u.Query().Get("Name") != "vtolstov" || u.Query().Get("Field1") != "field1" {
t.Fatalf("invalid values %v", u.Query())
}
} }
func TestValidPath(t *testing.T) { func TestValidPath(t *testing.T) {
req := &Request{Name: "vtolstov", Field1: "field1", Field2: "field2", Field3: 10} req := &Request{Name: "vtolstov", Field1: "field1", Field2: "field2", Field3: 10}
p, m, err := newPathRequest("/api/v1/{name}/list", "GET", "", req, nil) p, m, err := newPathRequest("/api/v1/{name}/list", "GET", "", req, nil, nil)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -32,9 +74,8 @@ func TestValidPath(t *testing.T) {
func TestInvalidPath(t *testing.T) { func TestInvalidPath(t *testing.T) {
req := &Request{Name: "vtolstov", Field1: "field1", Field2: "field2", Field3: 10} req := &Request{Name: "vtolstov", Field1: "field1", Field2: "field2", Field3: 10}
p, m, err := newPathRequest("/api/v1/{xname}/list", "GET", "", req, nil) _, _, err := newPathRequest("/api/v1/{xname}/list", "GET", "", req, nil, nil)
if err == nil { if err == nil {
t.Fatalf("path param must not be filled") t.Fatal("path param must not be filled")
} }
_, _ = p, m
} }

View File

@ -1,36 +0,0 @@
package http
import (
"github.com/unistack-org/micro/v3/client"
)
type httpMessage struct {
payload interface{}
topic string
contentType string
}
func newHTTPMessage(topic string, payload interface{}, contentType string, opts ...client.MessageOption) client.Message {
options := client.NewMessageOptions(opts...)
if len(options.ContentType) == 0 {
options.ContentType = contentType
}
return &httpMessage{
payload: payload,
topic: topic,
contentType: options.ContentType,
}
}
func (h *httpMessage) ContentType() string {
return h.contentType
}
func (h *httpMessage) Topic() string {
return h.topic
}
func (h *httpMessage) Payload() interface{} {
return h.payload
}

View File

@ -4,8 +4,8 @@ import (
"net" "net"
"net/http" "net/http"
"github.com/unistack-org/micro/v3/client" "go.unistack.org/micro/v4/metadata"
"github.com/unistack-org/micro/v3/metadata" "go.unistack.org/micro/v4/options"
) )
var ( var (
@ -29,77 +29,98 @@ var (
type poolMaxStreams struct{} type poolMaxStreams struct{}
// PoolMaxStreams maximum streams on a connectioin // PoolMaxStreams maximum streams on a connectioin
func PoolMaxStreams(n int) client.Option { func PoolMaxStreams(n int) options.Option {
return client.SetOption(poolMaxStreams{}, n) return options.ContextOption(poolMaxStreams{}, n)
} }
type poolMaxIdle struct{} type poolMaxIdle struct{}
// PoolMaxIdle maximum idle conns of a pool // PoolMaxIdle maximum idle conns of a pool
func PoolMaxIdle(d int) client.Option { func PoolMaxIdle(d int) options.Option {
return client.SetOption(poolMaxIdle{}, d) return options.ContextOption(poolMaxIdle{}, d)
} }
type maxRecvMsgSizeKey struct{} type maxRecvMsgSizeKey struct{}
// MaxRecvMsgSize set the maximum size of message that client can receive. // MaxRecvMsgSize set the maximum size of message that client can receive.
func MaxRecvMsgSize(s int) client.Option { func MaxRecvMsgSize(s int) options.Option {
return client.SetOption(maxRecvMsgSizeKey{}, s) return options.ContextOption(maxRecvMsgSizeKey{}, s)
} }
type maxSendMsgSizeKey struct{} type maxSendMsgSizeKey struct{}
// MaxSendMsgSize set the maximum size of message that client can send. // MaxSendMsgSize set the maximum size of message that client can send.
func MaxSendMsgSize(s int) client.Option { func MaxSendMsgSize(s int) options.Option {
return client.SetOption(maxSendMsgSizeKey{}, s) return options.ContextOption(maxSendMsgSizeKey{}, s)
} }
type httpClientKey struct{} type httpClientKey struct{}
// nolint: golint // nolint: golint
func HTTPClient(c *http.Client) client.Option { // HTTPClient pass http.Client option to client Call
return client.SetOption(httpClientKey{}, c) func HTTPClient(c *http.Client) options.Option {
return options.ContextOption(httpClientKey{}, c)
} }
type httpDialerKey struct{} type httpDialerKey struct{}
// nolint: golint // nolint: golint
func HTTPDialer(d *net.Dialer) client.Option { // HTTPDialer pass net.Dialer option to client
return client.SetOption(httpDialerKey{}, d) func HTTPDialer(d *net.Dialer) options.Option {
return options.ContextOption(httpDialerKey{}, d)
} }
type methodKey struct{} type methodKey struct{}
func Method(m string) client.CallOption { // Method pass method option to client Call
return client.SetCallOption(methodKey{}, m) func Method(m string) options.Option {
return options.ContextOption(methodKey{}, m)
} }
type pathKey struct{} type pathKey struct{}
func Path(p string) client.CallOption { // Path spcecifies path option to client Call
return client.SetCallOption(pathKey{}, p) func Path(p string) options.Option {
return options.ContextOption(pathKey{}, p)
} }
type bodyKey struct{} type bodyKey struct{}
func Body(b string) client.CallOption { // Body specifies body option to client Call
return client.SetCallOption(bodyKey{}, b) func Body(b string) options.Option {
return options.ContextOption(bodyKey{}, b)
} }
type errorMapKey struct{} type errorMapKey struct{}
func ErrorMap(m map[string]interface{}) client.CallOption { func ErrorMap(m map[string]interface{}) options.Option {
return client.SetCallOption(errorMapKey{}, m) return options.ContextOption(errorMapKey{}, m)
} }
type structTagsKey struct{} type structTagsKey struct{}
func StructTags(tags []string) client.CallOption { // StructTags pass tags slice option to client Call
return client.SetCallOption(structTagsKey{}, tags) func StructTags(tags []string) options.Option {
return options.ContextOption(structTagsKey{}, tags)
} }
type metadataKey struct{} type metadataKey struct{}
func Metadata(md metadata.Metadata) client.CallOption { // Metadata pass metadata to client Call
return client.SetCallOption(metadataKey{}, md) func Metadata(md metadata.Metadata) options.Option {
return options.ContextOption(metadataKey{}, md)
}
type cookieKey struct{}
// Cookie pass cookie to client Call
func Cookie(cookies ...string) options.Option {
return options.ContextOption(cookieKey{}, cookies)
}
type headerKey struct{}
// Header pass cookie to client Call
func Header(headers ...string) options.Option {
return options.ContextOption(headerKey{}, headers)
} }

View File

@ -1,8 +1,9 @@
package http package http
import ( import (
"github.com/unistack-org/micro/v3/client" "go.unistack.org/micro/v4/client"
"github.com/unistack-org/micro/v3/codec" "go.unistack.org/micro/v4/codec"
"go.unistack.org/micro/v4/options"
) )
type httpRequest struct { type httpRequest struct {
@ -13,7 +14,7 @@ type httpRequest struct {
opts client.RequestOptions opts client.RequestOptions
} }
func newHTTPRequest(service, method string, request interface{}, contentType string, opts ...client.RequestOption) client.Request { func newHTTPRequest(service, method string, request interface{}, contentType string, opts ...options.Option) client.Request {
options := client.NewRequestOptions(opts...) options := client.NewRequestOptions(opts...)
if len(options.ContentType) == 0 { if len(options.ContentType) == 0 {
options.ContentType = contentType options.ContentType = contentType

View File

@ -9,9 +9,10 @@ import (
"net/http" "net/http"
"sync" "sync"
"github.com/unistack-org/micro/v3/client" "go.unistack.org/micro/v4/client"
"github.com/unistack-org/micro/v3/codec" "go.unistack.org/micro/v4/codec"
"github.com/unistack-org/micro/v3/errors" "go.unistack.org/micro/v4/errors"
"go.unistack.org/micro/v4/logger"
) )
// Implements the streamer interface // Implements the streamer interface
@ -20,6 +21,7 @@ type httpStream struct {
conn net.Conn conn net.Conn
cf codec.Codec cf codec.Codec
context context.Context context context.Context
logger logger.Logger
request client.Request request client.Request
closed chan bool closed chan bool
reader *bufio.Reader reader *bufio.Reader
@ -52,6 +54,10 @@ func (h *httpStream) Response() client.Response {
return nil return nil
} }
func (h *httpStream) SendMsg(msg interface{}) error {
return h.Send(msg)
}
func (h *httpStream) Send(msg interface{}) error { func (h *httpStream) Send(msg interface{}) error {
h.Lock() h.Lock()
defer h.Unlock() defer h.Unlock()
@ -61,7 +67,7 @@ func (h *httpStream) Send(msg interface{}) error {
return errShutdown return errShutdown
} }
hreq, err := newRequest(h.context, h.address, h.request, h.ct, h.cf, msg, h.opts) hreq, err := newRequest(h.context, h.logger, h.address, h.request, h.ct, h.cf, msg, h.opts)
if err != nil { if err != nil {
return err return err
} }
@ -69,6 +75,10 @@ func (h *httpStream) Send(msg interface{}) error {
return hreq.Write(h.conn) return hreq.Write(h.conn)
} }
func (h *httpStream) RecvMsg(msg interface{}) error {
return h.Recv(msg)
}
func (h *httpStream) Recv(msg interface{}) error { func (h *httpStream) Recv(msg interface{}) error {
h.Lock() h.Lock()
defer h.Unlock() defer h.Unlock()
@ -84,7 +94,7 @@ func (h *httpStream) Recv(msg interface{}) error {
} }
defer hrsp.Body.Close() defer hrsp.Body.Close()
return h.parseRsp(h.context, hrsp, h.cf, msg, h.opts) return h.parseRsp(h.context, h.logger, hrsp, h.cf, msg, h.opts)
} }
func (h *httpStream) Error() error { func (h *httpStream) Error() error {
@ -93,6 +103,10 @@ func (h *httpStream) Error() error {
return h.err return h.err
} }
func (h *httpStream) CloseSend() error {
return h.Close()
}
func (h *httpStream) Close() error { func (h *httpStream) Close() error {
select { select {
case <-h.closed: case <-h.closed:
@ -103,41 +117,57 @@ func (h *httpStream) Close() error {
} }
} }
func (h *httpStream) parseRsp(ctx context.Context, hrsp *http.Response, cf codec.Codec, rsp interface{}, opts client.CallOptions) error { func (h *httpStream) parseRsp(ctx context.Context, log logger.Logger, hrsp *http.Response, cf codec.Codec, rsp interface{}, opts client.CallOptions) error {
var err error var err error
var buf []byte
// fast path return
if hrsp.StatusCode == http.StatusNoContent {
return nil
}
select { select {
case <-ctx.Done(): case <-ctx.Done():
err = ctx.Err() err = ctx.Err()
default: default:
// fast path return if hrsp.Body != nil {
if hrsp.StatusCode == http.StatusNoContent { buf, err = io.ReadAll(hrsp.Body)
return nil if err != nil {
if log.V(logger.ErrorLevel) {
log.Error(ctx, "failed to read body", err)
}
return errors.InternalServerError("go.micro.client", string(buf))
}
}
if log.V(logger.DebugLevel) {
log.Debug(ctx, fmt.Sprintf("response %s with %v", buf, hrsp.Header))
} }
if hrsp.StatusCode < 400 { if hrsp.StatusCode < 400 {
if err = cf.ReadBody(hrsp.Body, rsp); err != nil { if err = cf.Unmarshal(buf, rsp); err != nil {
return errors.InternalServerError("go.micro.client", err.Error()) return errors.InternalServerError("go.micro.client", err.Error())
} }
return nil return nil
} }
var rerr interface{}
errmap, ok := opts.Context.Value(errorMapKey{}).(map[string]interface{}) errmap, ok := opts.Context.Value(errorMapKey{}).(map[string]interface{})
if ok && errmap != nil { if ok && errmap != nil {
if err, ok = errmap[fmt.Sprintf("%d", hrsp.StatusCode)].(error); !ok { if rerr, ok = errmap[fmt.Sprintf("%d", hrsp.StatusCode)].(error); !ok {
err, ok = errmap["default"].(error) rerr, ok = errmap["default"].(error)
} }
} }
if !ok || err == nil { if !ok || rerr == nil {
buf, cerr := io.ReadAll(hrsp.Body)
if cerr != nil {
return errors.InternalServerError("go.micro.client", cerr.Error())
}
return errors.New("go.micro.client", string(buf), int32(hrsp.StatusCode)) return errors.New("go.micro.client", string(buf), int32(hrsp.StatusCode))
} }
if cerr := cf.ReadBody(hrsp.Body, err); cerr != nil { if cerr := cf.Unmarshal(buf, rerr); cerr != nil {
err = errors.InternalServerError("go.micro.client", cerr.Error()) return errors.InternalServerError("go.micro.client", cerr.Error())
}
if err, ok = rerr.(error); !ok {
err = &Error{rerr}
} }
} }

175
util.go
View File

@ -10,10 +10,11 @@ import (
"strings" "strings"
"sync" "sync"
"github.com/unistack-org/micro/v3/client" "go.unistack.org/micro/v4/client"
"github.com/unistack-org/micro/v3/errors" "go.unistack.org/micro/v4/errors"
"github.com/unistack-org/micro/v3/logger" "go.unistack.org/micro/v4/logger"
rutil "github.com/unistack-org/micro/v3/util/reflect" "go.unistack.org/micro/v4/metadata"
rutil "go.unistack.org/micro/v4/util/reflect"
) )
var ( var (
@ -38,7 +39,7 @@ func GetError(err error) interface{} {
return err return err
} }
func newPathRequest(path string, method string, body string, msg interface{}, tags []string) (string, interface{}, error) { func newPathRequest(path string, method string, body string, msg interface{}, tags []string, parameters map[string]map[string]string) (string, interface{}, error) {
// parse via https://github.com/googleapis/googleapis/blob/master/google/api/http.proto definition // parse via https://github.com/googleapis/googleapis/blob/master/google/api/http.proto definition
tpl, err := newTemplate(path) tpl, err := newTemplate(path)
if err != nil { if err != nil {
@ -52,10 +53,20 @@ func newPathRequest(path string, method string, body string, msg interface{}, ta
fieldsmapskip := make(map[string]struct{}) fieldsmapskip := make(map[string]struct{})
fieldsmap := make(map[string]string, len(tpl)) fieldsmap := make(map[string]string, len(tpl))
for _, v := range tpl { for _, v := range tpl {
if v[0] != '{' || v[len(v)-1] != '}' { var vs, ve int
continue for i := 0; i < len(v); i++ {
switch v[i] {
case '{':
vs = i + 1
case '}':
ve = i
}
if ve != 0 {
fieldsmap[v[vs:ve]] = ""
vs = 0
ve = 0
}
} }
fieldsmap[v[1:len(v)-1]] = ""
} }
nmsg, err := rutil.Zero(msg) nmsg, err := rutil.Zero(msg)
@ -82,7 +93,15 @@ func newPathRequest(path string, method string, body string, msg interface{}, ta
continue continue
} }
fld := tmsg.Type().Field(i) fld := tmsg.Type().Field(i)
// Skip unexported fields.
if fld.PkgPath != "" {
continue
}
/* check for empty PkgPath can be replaced with new method IsExported
if !fld.IsExported() {
continue
}
*/
t := &tag{} t := &tag{}
for _, tn := range tags { for _, tn := range tags {
ts, ok := fld.Tag.Lookup(tn) ts, ok := fld.Tag.Lookup(tn)
@ -107,10 +126,18 @@ func newPathRequest(path string, method string, body string, msg interface{}, ta
} }
} }
if t.name == "" { cname := t.name
if cname == "" {
cname = fld.Name
// fallback to lowercase // fallback to lowercase
t.name = strings.ToLower(fld.Name) t.name = strings.ToLower(fld.Name)
} }
if _, ok := parameters["header"][cname]; ok {
continue
}
if _, ok := parameters["cookie"][cname]; ok {
continue
}
if !val.IsValid() || val.IsZero() { if !val.IsValid() || val.IsZero() {
continue continue
@ -121,11 +148,11 @@ func newPathRequest(path string, method string, body string, msg interface{}, ta
switch val.Type().Kind() { switch val.Type().Kind() {
case reflect.Slice: case reflect.Slice:
for idx := 0; idx < val.Len(); idx++ { for idx := 0; idx < val.Len(); idx++ {
values.Add(t.name, fmt.Sprintf("%v", val.Index(idx).Interface())) values.Add(t.name, getParam(val.Index(idx)))
} }
fieldsmapskip[t.name] = struct{}{} fieldsmapskip[t.name] = struct{}{}
default: default:
fieldsmap[t.name] = fmt.Sprintf("%v", val.Interface()) fieldsmap[t.name] = getParam(val)
} }
} else if (body == "*" || body == t.name) && method != http.MethodGet { } else if (body == "*" || body == t.name) && method != http.MethodGet {
if tnmsg.Field(i).CanSet() { if tnmsg.Field(i).CanSet() {
@ -134,10 +161,10 @@ func newPathRequest(path string, method string, body string, msg interface{}, ta
} else { } else {
if val.Type().Kind() == reflect.Slice { if val.Type().Kind() == reflect.Slice {
for idx := 0; idx < val.Len(); idx++ { for idx := 0; idx < val.Len(); idx++ {
values.Add(t.name, fmt.Sprintf("%v", val.Index(idx).Interface())) values.Add(t.name, getParam(val.Index(idx)))
} }
} else { } else {
values.Add(t.name, fmt.Sprintf("%v", val.Interface())) values.Add(t.name, getParam(val))
} }
} }
} }
@ -151,17 +178,36 @@ func newPathRequest(path string, method string, body string, msg interface{}, ta
} }
var b strings.Builder var b strings.Builder
for _, fld := range tpl { for _, fld := range tpl {
_, _ = b.WriteRune('/') _, _ = b.WriteRune('/')
if fld[0] == '{' && fld[len(fld)-1] == '}' { // nolint: nestif
if v, ok := fieldsmap[fld[1:len(fld)-1]]; ok { var vs, ve, vf int
if v != "" { var pholder bool
_, _ = b.WriteString(v) for i := 0; i < len(fld); i++ {
} switch fld[i] {
} else { case '{':
_, _ = b.WriteString(fld) vs = i + 1
case '}':
ve = i
} }
} else { // nolint: nestif
if vs > 0 && ve != 0 {
if vm, ok := fieldsmap[fld[vs:ve]]; ok {
if vm != "" {
_, _ = b.WriteString(fld[vf : vs-1])
_, _ = b.WriteString(vm)
vf = ve + 1
}
} else {
_, _ = b.WriteString(fld)
}
vs = 0
ve = 0
pholder = true
}
}
if !pholder {
_, _ = b.WriteString(fld) _, _ = b.WriteString(fld)
} }
} }
@ -171,13 +217,21 @@ func newPathRequest(path string, method string, body string, msg interface{}, ta
_, _ = b.WriteString(values.Encode()) _, _ = b.WriteString(values.Encode())
} }
if rutil.IsZero(nmsg) { if rutil.IsZero(nmsg) && !isEmptyStruct(nmsg) {
return b.String(), nil, nil return b.String(), nil, nil
} }
return b.String(), nmsg, nil return b.String(), nmsg, nil
} }
func isEmptyStruct(v interface{}) bool {
val := reflect.ValueOf(v)
if val.Kind() == reflect.Ptr {
val = val.Elem()
}
return val.Kind() == reflect.Struct && val.NumField() == 0
}
func newTemplate(path string) ([]string, error) { func newTemplate(path string) ([]string, error) {
if len(path) == 0 || path[0] != '/' { if len(path) == 0 || path[0] != '/' {
return nil, fmt.Errorf("path must starts with /") return nil, fmt.Errorf("path must starts with /")
@ -200,39 +254,55 @@ func newTemplate(path string) ([]string, error) {
func (h *httpClient) parseRsp(ctx context.Context, hrsp *http.Response, rsp interface{}, opts client.CallOptions) error { func (h *httpClient) parseRsp(ctx context.Context, hrsp *http.Response, rsp interface{}, opts client.CallOptions) error {
var err error var err error
var buf []byte
// fast path return
if hrsp.StatusCode == http.StatusNoContent {
return nil
}
if opts.ResponseMetadata != nil {
*opts.ResponseMetadata = metadata.New(len(hrsp.Header))
for k, v := range hrsp.Header {
opts.ResponseMetadata.Set(k, strings.Join(v, ","))
}
}
select { select {
case <-ctx.Done(): case <-ctx.Done():
err = ctx.Err() err = ctx.Err()
default: default:
// fast path return
if hrsp.StatusCode == http.StatusNoContent {
return nil
}
ct := DefaultContentType ct := DefaultContentType
if htype := hrsp.Header.Get("Content-Type"); htype != "" { if htype := hrsp.Header.Get("Content-Type"); htype != "" {
ct = htype ct = htype
} }
cf, cerr := h.newCodec(ct) if hrsp.Body != nil {
if hrsp.StatusCode >= 400 && cerr != nil { buf, err = io.ReadAll(hrsp.Body)
var buf []byte if err != nil {
if hrsp.Body != nil { if h.opts.Logger.V(logger.ErrorLevel) {
buf, err = io.ReadAll(hrsp.Body) h.opts.Logger.Error(ctx, "failed to read body", err)
if err != nil && h.opts.Logger.V(logger.ErrorLevel) {
h.opts.Logger.Errorf(ctx, "failed to read body: %v", err)
} }
return errors.InternalServerError("go.micro.client", string(buf))
}
}
cf, cerr := h.newCodec(ct)
if cerr != nil {
if h.opts.Logger.V(logger.DebugLevel) {
h.opts.Logger.Debug(ctx, fmt.Sprintf("response with %v unknown content-type %s %s", hrsp.Header, ct, buf))
} }
// response like text/plain or something else, return original error
return errors.New("go.micro.client", string(buf), int32(hrsp.StatusCode))
} else if cerr != nil {
return errors.InternalServerError("go.micro.client", cerr.Error()) return errors.InternalServerError("go.micro.client", cerr.Error())
} }
if h.opts.Logger.V(logger.DebugLevel) {
h.opts.Logger.Debug(ctx, fmt.Sprintf("response %s with %v", buf, hrsp.Header))
}
// succeseful response // succeseful response
if hrsp.StatusCode < 400 { if hrsp.StatusCode < 400 {
if err = cf.ReadBody(hrsp.Body, rsp); err != nil { if err = cf.Unmarshal(buf, rsp); err != nil {
return errors.InternalServerError("go.micro.client", err.Error()) return errors.InternalServerError("go.micro.client", err.Error())
} }
return nil return nil
@ -249,14 +319,10 @@ func (h *httpClient) parseRsp(ctx context.Context, hrsp *http.Response, rsp inte
} }
if !ok || rerr == nil { if !ok || rerr == nil {
buf, rerr := io.ReadAll(hrsp.Body)
if rerr != nil {
return errors.InternalServerError("go.micro.client", rerr.Error())
}
return errors.New("go.micro.client", string(buf), int32(hrsp.StatusCode)) return errors.New("go.micro.client", string(buf), int32(hrsp.StatusCode))
} }
if cerr := cf.ReadBody(hrsp.Body, rerr); cerr != nil { if cerr := cf.Unmarshal(buf, rerr); cerr != nil {
return errors.InternalServerError("go.micro.client", cerr.Error()) return errors.InternalServerError("go.micro.client", cerr.Error())
} }
@ -273,3 +339,26 @@ type tag struct {
key string key string
name string name string
} }
func getParam(val reflect.Value) string {
var v string
switch val.Kind() {
case reflect.Ptr:
switch reflect.Indirect(val).Type().String() {
case
"wrapperspb.BoolValue",
"wrapperspb.BytesValue",
"wrapperspb.DoubleValue",
"wrapperspb.FloatValue",
"wrapperspb.Int32Value", "wrapperspb.Int64Value",
"wrapperspb.StringValue",
"wrapperspb.UInt32Value", "wrapperspb.UInt64Value":
if eva := reflect.Indirect(val).FieldByName("Value"); eva.IsValid() {
v = getParam(eva)
}
}
default:
v = fmt.Sprintf("%v", val.Interface())
}
return v
}

View File

@ -14,7 +14,7 @@ func TestParsing(t *testing.T) {
for _, m := range []string{"POST"} { for _, m := range []string{"POST"} {
body := "" body := ""
path, nmsg, err := newPathRequest("/users/iin/{iin}/push-notifications", m, body, omsg, []string{"protobuf", "json"}) path, nmsg, err := newPathRequest("/users/iin/{iin}/push-notifications", m, body, omsg, []string{"protobuf", "json"}, nil)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -44,7 +44,7 @@ func TestNewPathRequest(t *testing.T) {
for _, m := range []string{"POST", "PUT", "PATCH", "GET", "DELETE"} { for _, m := range []string{"POST", "PUT", "PATCH", "GET", "DELETE"} {
body := "" body := ""
path, nmsg, err := newPathRequest("/v1/test", m, body, omsg, []string{"protobuf", "json"}) path, nmsg, err := newPathRequest("/v1/test", m, body, omsg, []string{"protobuf", "json"}, nil)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -59,6 +59,38 @@ func TestNewPathRequest(t *testing.T) {
} }
} }
func TestNewPathRequestWithEmptyBody(t *testing.T) {
val := struct{}{}
cases := []string{
"",
"*",
"{}",
"nil",
`{"type": "invalid"}`,
}
for _, body := range cases {
for _, m := range []string{"POST", "PUT", "PATCH", "GET", "DELETE"} {
path, nmsg, err := newPathRequest("/v1/test", m, body, val, []string{"protobuf", "json"}, nil)
if err != nil {
t.Fatal(err)
}
if nmsg == nil {
t.Fatalf("invalid path: nil nmsg")
}
u, err := url.Parse(path)
if err != nil {
t.Fatal(err)
}
vals := u.Query()
if len(vals) != 0 {
t.Fatalf("invalid path: %v nmsg: %v", path, nmsg)
}
}
}
}
func TestNewPathVarRequest(t *testing.T) { func TestNewPathVarRequest(t *testing.T) {
type Message struct { type Message struct {
Name string `json:"name"` Name string `json:"name"`
@ -74,7 +106,7 @@ func TestNewPathVarRequest(t *testing.T) {
if m != "GET" { if m != "GET" {
body = "*" body = "*"
} }
path, nmsg, err := newPathRequest("/v1/test/{val1}", m, body, omsg, []string{"protobuf", "json"}) path, nmsg, err := newPathRequest("/v1/test/{val1}", m, body, omsg, []string{"protobuf", "json"}, nil)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }