* 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](https://github.com/stretchr/testify/compare/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](https://github.com/open-telemetry/opentelemetry-go/compare/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](https://github.com/open-telemetry/opentelemetry-go/compare/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>
		
			
				
	
	
		
			139 lines
		
	
	
		
			6.4 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			139 lines
		
	
	
		
			6.4 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| // Copyright 2020 beego
 | |
| //
 | |
| // Licensed under the Apache License, Version 2.0 (the "License");
 | |
| // you may not use this file except in compliance with the License.
 | |
| // You may obtain a copy of the License at
 | |
| //
 | |
| // http://www.apache.org/licenses/LICENSE-2.0
 | |
| //
 | |
| // Unless required by applicable law or agreed to in writing, software
 | |
| // distributed under the License is distributed on an "AS IS" BASIS,
 | |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | |
| // See the License for the specific language governing permissions and
 | |
| // limitations under the License.
 | |
| 
 | |
| package httplib
 | |
| 
 | |
| import (
 | |
| 	"github.com/beego/beego/v2/core/berror"
 | |
| )
 | |
| 
 | |
| var InvalidUrl = berror.DefineCode(4001001, moduleName, "InvalidUrl", `
 | |
| You pass an invalid url to httplib module. Please check your url, be careful about special character. 
 | |
| `)
 | |
| 
 | |
| var InvalidUrlProtocolVersion = berror.DefineCode(4001002, moduleName, "InvalidUrlProtocolVersion", `
 | |
| You pass an invalid protocol version. In practice, we use HTTP/1.0, HTTP/1.1, HTTP/1.2
 | |
| But something like HTTP/3.2 is valid for client, and the major version is 3, minor version is 2.
 | |
| but you must confirm that server support those abnormal protocol version.
 | |
| `)
 | |
| 
 | |
| var UnsupportedBodyType = berror.DefineCode(4001003, moduleName, "UnsupportedBodyType", `
 | |
| You use an invalid data as request body.
 | |
| For now, we only support type string and byte[].
 | |
| `)
 | |
| 
 | |
| var InvalidXMLBody = berror.DefineCode(4001004, moduleName, "InvalidXMLBody", `
 | |
| You pass invalid data which could not be converted to XML documents. In general, if you pass structure, it works well.
 | |
| Sometimes you got XML document and you want to make it as request body. So you call XMLBody.
 | |
| If you do this, you got this code. Instead, you should call Header to set Content-type and call Body to set body data.
 | |
| `)
 | |
| 
 | |
| var InvalidYAMLBody = berror.DefineCode(4001005, moduleName, "InvalidYAMLBody", `
 | |
| You pass invalid data which could not be converted to YAML documents. In general, if you pass structure, it works well.
 | |
| Sometimes you got YAML document and you want to make it as request body. So you call YAMLBody.
 | |
| If you do this, you got this code. Instead, you should call Header to set Content-type and call Body to set body data.
 | |
| `)
 | |
| 
 | |
| var InvalidJSONBody = berror.DefineCode(4001006, moduleName, "InvalidJSONBody", `
 | |
| You pass invalid data which could not be converted to JSON documents. In general, if you pass structure, it works well.
 | |
| Sometimes you got JSON document and you want to make it as request body. So you call JSONBody.
 | |
| If you do this, you got this code. Instead, you should call Header to set Content-type and call Body to set body data.
 | |
| `)
 | |
| 
 | |
| var InvalidURLOrMethod = berror.DefineCode(4001007, moduleName, "InvalidURLOrMethod", `
 | |
| You pass invalid url or method to httplib module. Please check the url and method, be careful about special characters.
 | |
| `)
 | |
| 
 | |
| // start with 5 --------------------------------------------------------------------------
 | |
| 
 | |
| var CreateFormFileFailed = berror.DefineCode(5001001, moduleName, "CreateFormFileFailed", `
 | |
| In normal case than handling files with BeegoRequest, you should not see this error code.
 | |
| Unexpected EOF, invalid characters, bad file descriptor may cause this error.
 | |
| `)
 | |
| 
 | |
| var ReadFileFailed = berror.DefineCode(5001002, moduleName, "ReadFileFailed", `
 | |
| There are several cases that cause this error:
 | |
| 1. file not found. Please check the file name;
 | |
| 2. file not found, but file name is correct. If you use relative file path, it's very possible for you to see this code.
 | |
| make sure that this file is in correct directory which Beego looks for;
 | |
| 3. Beego don't have the privilege to read this file, please change file mode; 
 | |
| `)
 | |
| 
 | |
| var CopyFileFailed = berror.DefineCode(5001003, moduleName, "CopyFileFailed", `
 | |
| When we try to read file content and then copy it to another writer, and failed.
 | |
| 1. Unexpected EOF;
 | |
| 2. Bad file descriptor;
 | |
| 3. Write conflict;
 | |
| 
 | |
| Please check your file content, and confirm that file is not processed by other process (or by user manually).
 | |
| `)
 | |
| 
 | |
| var CloseFileFailed = berror.DefineCode(5001004, moduleName, "CloseFileFailed", `
 | |
| After handling files, Beego try to close file but failed. Usually it was caused by bad file descriptor.
 | |
| `)
 | |
| 
 | |
| var SendRequestFailed = berror.DefineCode(5001005, moduleName, "SendRequestRetryExhausted", `
 | |
| Beego send HTTP request, but it failed.
 | |
| If you config retry times, it means that Beego had retried and failed.
 | |
| When you got this error, there are vary kind of reason:
 | |
| 1. Network unstable and timeout. In this case, sometimes server has received the request.
 | |
| 2. Server error. Make sure that server works well.
 | |
| 3. The request is invalid, which means that you pass some invalid parameter.
 | |
| `)
 | |
| 
 | |
| var ReadGzipBodyFailed = berror.DefineCode(5001006, moduleName, "BuildGzipReaderFailed", `
 | |
| Beego parse gzip-encode body failed. Usually Beego got invalid response.
 | |
| Please confirm that server returns gzip data.
 | |
| `)
 | |
| 
 | |
| var CreateFileIfNotExistFailed = berror.DefineCode(5001007, moduleName, "CreateFileIfNotExist", `
 | |
| Beego want to create file if not exist and failed. 
 | |
| In most cases, it means that Beego doesn't have the privilege to create this file.
 | |
| Please change file mode to ensure that Beego is able to create files on specific directory.
 | |
| Or you can run Beego with higher authority.
 | |
| In some cases, you pass invalid filename. Make sure that the file name is valid on your system.
 | |
| `)
 | |
| 
 | |
| var UnmarshalJSONResponseToObjectFailed = berror.DefineCode(5001008, moduleName,
 | |
| 	"UnmarshalResponseToObjectFailed", `
 | |
| Beego trying to unmarshal response's body to structure but failed.
 | |
| Make sure that:
 | |
| 1. You pass valid structure pointer to the function;
 | |
| 2. The body is valid json document
 | |
| `)
 | |
| 
 | |
| var UnmarshalXMLResponseToObjectFailed = berror.DefineCode(5001009, moduleName,
 | |
| 	"UnmarshalResponseToObjectFailed", `
 | |
| Beego trying to unmarshal response's body to structure but failed.
 | |
| Make sure that:
 | |
| 1. You pass valid structure pointer to the function;
 | |
| 2. The body is valid XML document
 | |
| `)
 | |
| 
 | |
| var UnmarshalYAMLResponseToObjectFailed = berror.DefineCode(5001010, moduleName,
 | |
| 	"UnmarshalResponseToObjectFailed", `
 | |
| Beego trying to unmarshal response's body to structure but failed.
 | |
| Make sure that:
 | |
| 1. You pass valid structure pointer to the function;
 | |
| 2. The body is valid YAML document
 | |
| `)
 | |
| 
 | |
| var UnmarshalResponseToObjectFailed = berror.DefineCode(5001011, moduleName,
 | |
| 	"UnmarshalResponseToObjectFailed", `
 | |
| Beego trying to unmarshal response's body to structure but failed.
 | |
| There are several cases that cause this error:
 | |
| 1. You pass valid structure pointer to the function;
 | |
| 2. The body is valid json, Yaml or XML document
 | |
| `)
 |