-
Notifications
You must be signed in to change notification settings - Fork 248
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
When encountering overly large receipt data, the returned JSON will be truncated, resulting in JSON validation failure #240
Comments
@MissWho Here are some questions
|
Sorry for waiting for a long time. After multiple checks, it seems to be a resp The incomplete data returned by Body resulted in JSON parsing failure with error code EOF. After adding my own debugging code, the file written to the disk was legal and the data could be parsed normally file:appstore\validator.go 188line |
@MissWho Thank you for your response. The invalid response JSON data caused the JSON Decode failure, and the invalid JSON data with EOF returned from the test URL. Please correct me if something was misunderstanding. |
@richzw How could EOF occur in the data returned by Apple's server? My own test code using json.Unmarshal can decode it successfully, but when using the original json.NewDecoder, it throws an EOF error. I'm using the same body in both cases. If it weren't for the inclusion of sensitive information, I would have sent you the test code already. I need your help in investigating this issue, as I'm starting to doubt whether it's a problem with my code. |
@MissWho Sorry for misunderstanding of your previous response. Let's double-check the following
buf, err := io.ReadAll(resp.Body)
if err != nil {
return 0, err
}
err = json.Unmarshal(buf, &result)
if err != nil {
return 0, err
} could parse the response body successfully.
|
However, there's still a very peculiar issue: if I execute the validation request separately within the main function, this problem doesn't occur. My current application scenario is within a web service's API. There are still many factors contributing to this issue. |
|
@MissWho , If the |
One more thing, The verifyReceipt API has been deprecated as of 5 Jun 2023. Please use App Store Server API instead. |
I used sandbox credentials with an order of 500 during testing. After the production environment returned 21007, the data returned by the second call to c.httpCli. Do (req) was truncated. When I replaced another library, the returned data was normal
Incomplete data, JSON parsing failed
The data returned is complete, and JSON parsing is normal.
The text was updated successfully, but these errors were encountered: