Skip to content

fix: 开放ErrUnauthorized错误供外界使用#23

Merged
flycash merged 1 commit into
ecodeclub:mainfrom
longyue0521:feat_err
Apr 5, 2024
Merged

fix: 开放ErrUnauthorized错误供外界使用#23
flycash merged 1 commit into
ecodeclub:mainfrom
longyue0521:feat_err

Conversation

@longyue0521
Copy link
Copy Markdown
Contributor

当前ginx开放给外界使用的仅有ErrNoResponse, 而ErrUnauthorized并未开放,所以下方代码也就无法被外界利用

// 如果里面有权限校验,那么会返回 401 错误(目前来看,主要是登录态校验)
		if errors.Is(err, errs.ErrUnauthorized) {
			slog.Debug("未授权", slog.Any("err", err))
			ctx.AbortWithStatus(http.StatusUnauthorized)
			return
		}

故开放ErrUnauthorized

Signed-off-by: longyue0521 <longyueli0521@gmail.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.75%. Comparing base (80840e6) to head (d74c06b).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #23   +/-   ##
=======================================
  Coverage   83.75%   83.75%           
=======================================
  Files          20       20           
  Lines         591      591           
=======================================
  Hits          495      495           
  Misses         88       88           
  Partials        8        8           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants