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

Client duplicates the response from the server making it invalid #212

Open
likont opened this issue Sep 19, 2020 · 3 comments
Open

Client duplicates the response from the server making it invalid #212

likont opened this issue Sep 19, 2020 · 3 comments

Comments

@likont
Copy link

likont commented Sep 19, 2020

Description

I am sending a request to the API. HTTP Client duplicates the response body. As a result, when accessing the "data" property, I get an exception: "Syntax error".

Example, the object must be of the format:
"tid":4828,"dcid":{"x":482222},"paid":true,"error":[]}

But in the HTTP Client response (when using the getContent() method):
{"tid":4828,"dcid":{"x":482222},"paid":true,"error":[]}{ "tid": 4828, "dcid": { "x": 482222 }, "paid": true, "error": [] }

I thought it was a vendor problem, but by sending a request through Postman, I received a valid response. (screenshot)

Request Object: https://pastebin.com/kU0kPWnQ
Response Object: https://pastebin.com/WCgEik1p
Some values have been replaced for safety

What steps will reproduce the problem?

Unfortunately, it is not known exactly. I am using this API, method: https://apirosreestr.ru/api/#Cadaster/Orders

What's expected?

Valid JSON format like:
{"tid":4828,"dcid":{"x":482222},"paid":true,"error":[]}

What do you get instead?

Duplicate json that is invalid like:
{"tid":4828,"dcid":{"x":482222},"paid":true,"error":[]}{ "tid": 4828, "dcid": { "x": 482222 }, "paid": true, "error": [] }

Additional info

Q A
Yii version 2.0.36
Yii HTTP Client version 2.0.12
PHP version 7.2.27
Operating system CentOS 7
@bizley bizley added the status:to be verified Needs to be reproduced and validated. label Sep 19, 2020
@samdark
Copy link
Member

samdark commented Sep 21, 2020

Does that happen for any other URL?

@likont
Copy link
Author

likont commented Sep 22, 2020

Does that happen for any other URL?

Only with this action: https://apirosreestr.ru/api/cadaster/save_order
You can see the request object in the first post. Duplicate: https://pastebin.com/kU0kPWnQ

Important: Service support reported that the http client may not respond to the "Connection: close" header

@samdark
Copy link
Member

samdark commented Sep 29, 2020

Likely it is so.

@bizley bizley added help wanted and removed status:need more info status:to be verified Needs to be reproduced and validated. labels Jun 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants