Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: revise the body wrapper to handle empty body case #5102

Merged
merged 1 commit into from
Nov 22, 2022

Conversation

chlins
Copy link
Contributor

@chlins chlins commented Nov 22, 2022

Fix the router.go serverHttp method, wrap the body if the request body is empty, which can avoid panic when calling the CopyBody method.

Signed-off-by: chlins chenyuzh@vmware.com

@codecov-commenter
Copy link

Codecov Report

Merging #5102 (196061b) into develop (1bb607b) will decrease coverage by 0.00%.
The diff coverage is 80.00%.

@@             Coverage Diff             @@
##           develop    #5102      +/-   ##
===========================================
- Coverage    54.84%   54.84%   -0.01%     
===========================================
  Files          246      246              
  Lines        21893    21896       +3     
===========================================
+ Hits         12007    12008       +1     
- Misses        8933     8935       +2     
  Partials       953      953              
Impacted Files Coverage Δ
server/web/router.go 71.14% <80.00%> (+0.13%) ⬆️
adapter/session/session.go 29.26% <0.00%> (-4.88%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Fix the router.go serverHttp method, wrap the body if the request body
is empty, which can avoid panic when calling the CopyBody method.

Signed-off-by: chlins <chenyuzh@vmware.com>
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.4% 0.4% Duplication

Copy link
Contributor

@wy65701436 wy65701436 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@flycash flycash merged commit cc5a025 into beego:develop Nov 22, 2022
flycash added a commit that referenced this pull request Nov 22, 2022
* add: generic cache random time offset expired.

* bugfix: Csrf token should be Secure and httpOnly, but not now

* fix: expose the Offset property to allow external modifications

* improving the concurrency performance of random value calculation

* add WithOffsetFunc to define private RandomExpireCache.offset field

* fix: add seconds definition

* build(deps): bump github.com/stretchr/testify from 1.7.1 to 1.8.0

Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.1 to 1.8.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](stretchr/testify@v1.7.1...v1.8.0)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

* fix 4907: force admin service http only

* Feat: add get all tasks function (#4999)

* feat: add get all tasks function

* Refine Comments : admin/profile.go,bean/mock.go,config/global.go... (#5009)

* Refine Comments

* refine comments for cache.go

* refine comments for log.go

* Update orm.go

* refine comments for orm_log.go,types.go

* Update utils.go

* Update doc.go

* refine comments for for four files (#5011)

* refine comments for cache.go

* refine comments for log.go

* Update orm.go

* refine comments for orm_log.go,types.go

* Update utils.go

* Update doc.go

* Update db.go

* fix pass []any as any in variadic function by asasalint (#5012)

* fix pass []any as any in variadic function

* add change log

* build(deps): bump go.opentelemetry.io/otel/trace from 1.7.0 to 1.8.0 (#5019)

Bumps [go.opentelemetry.io/otel/trace](https://github.com/open-telemetry/opentelemetry-go) from 1.7.0 to 1.8.0.
- [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md)
- [Commits](open-telemetry/opentelemetry-go@v1.7.0...v1.8.0)

---
updated-dependencies:
- dependency-name: go.opentelemetry.io/otel/trace
  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>

* refine comments for package core  (#5014)

* Refine Comments

* refine comments for cache.go

* refine comments for log.go

* Update orm.go

* refine comments for orm_log.go,types.go

* Update utils.go

* Update doc.go

* refine comments

* refine comments

* Update db.go

* refine comments for core

* build(deps): bump go.opentelemetry.io/otel/exporters/stdout/stdouttrace (#5018)

Bumps [go.opentelemetry.io/otel/exporters/stdout/stdouttrace](https://github.com/open-telemetry/opentelemetry-go) from 1.7.0 to 1.8.0.
- [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md)
- [Commits](open-telemetry/opentelemetry-go@v1.7.0...v1.8.0)

---
updated-dependencies:
- dependency-name: go.opentelemetry.io/otel/exporters/stdout/stdouttrace
  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>

* fix 5022: Miss assiging ln to graceful Server (#5028)

* prepare for releasing v2.0.5

* prepare for releasing v2.0.5 (#5032)

* feat: make commands and docker compose for ORM unit tests (#5031)

* feat: make commands and docker compose for ORM unit tests

Signed-off-by: mango <xu.weiKyrie@foxmail.com>

* add changelog

Signed-off-by: mango <xu.weiKyrie@foxmail.com>

Signed-off-by: mango <xu.weiKyrie@foxmail.com>

* Modify comment syntax error (#5094)

* fix: revise the body wrapper to handle empty body case (#5102)

Fix the router.go serverHttp method, wrap the body if the request body
is empty, which can avoid panic when calling the CopyBody method.

Signed-off-by: chlins <chenyuzh@vmware.com>

Signed-off-by: chlins <chenyuzh@vmware.com>

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: mango <xu.weiKyrie@foxmail.com>
Signed-off-by: chlins <chenyuzh@vmware.com>
Co-authored-by: auual <ding@ibyte.me>
Co-authored-by: Leon Ding <deen.job@qq.com>
Co-authored-by: dada0z <zhang.guangda@qq.com>
Co-authored-by: kevinzeng <kevinzeng@zego.im>
Co-authored-by: Kevin Tsang <39397413+ktalg@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: 日暮颂歌1991 <448081525@qq.com>
Co-authored-by: Regan Yue <1131625869@qq.com>
Co-authored-by: alingse <alingse@foxmail.com>
Co-authored-by: mango <35127166+mangoGoForward@users.noreply.github.com>
Co-authored-by: 王哈哈 <31426858+wanghaha-dev@users.noreply.github.com>
Co-authored-by: Chlins Zhang <chlins.zhang@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants