mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-07 23:41:22 +08:00
change: add ocr response logID
This commit is contained in:
@@ -1 +1 @@
|
|||||||
v4.3.0-beta-10131119
|
v4.3.0-beta-10160931
|
||||||
@@ -71,7 +71,11 @@ func (s *veDEMOCRService) getOCRResult(imageBuf []byte) ([]OCRResult, error) {
|
|||||||
req.Header.Add("Content-Type", bodyWriter.FormDataContentType())
|
req.Header.Add("Content-Type", bodyWriter.FormDataContentType())
|
||||||
resp, err := client.Do(req)
|
resp, err := client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("http reqeust OCR server error: %v", err)
|
var logID string
|
||||||
|
if resp != nil {
|
||||||
|
logID = getLogID(resp.Header)
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("http reqeust veDEM OCR server error: %v, logID: %s", err, logID)
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
@@ -93,6 +97,18 @@ func (s *veDEMOCRService) getOCRResult(imageBuf []byte) ([]OCRResult, error) {
|
|||||||
return ocrResult.OCRResult, nil
|
return ocrResult.OCRResult, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getLogID(header http.Header) string {
|
||||||
|
if len(header) == 0 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
logID, ok := header["X-Tt-Logid"]
|
||||||
|
if !ok || len(logID) == 0 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return logID[0]
|
||||||
|
}
|
||||||
|
|
||||||
func (s *veDEMOCRService) FindText(text string, imageBuf []byte, index ...int) (rect image.Rectangle, err error) {
|
func (s *veDEMOCRService) FindText(text string, imageBuf []byte, index ...int) (rect image.Rectangle, err error) {
|
||||||
if len(index) == 0 {
|
if len(index) == 0 {
|
||||||
index = []int{0} // index not specified
|
index = []int{0} // index not specified
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
__version__ = "v4.3.0-beta-10131119"
|
__version__ = "v4.3.0-beta-10160931"
|
||||||
__description__ = "One-stop solution for HTTP(S) testing."
|
__description__ = "One-stop solution for HTTP(S) testing."
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "httprunner"
|
name = "httprunner"
|
||||||
version = "v4.3.0-beta-10131119"
|
version = "v4.3.0-beta-10160931"
|
||||||
description = "One-stop solution for HTTP(S) testing."
|
description = "One-stop solution for HTTP(S) testing."
|
||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|||||||
Reference in New Issue
Block a user