-
Notifications
You must be signed in to change notification settings - Fork 51
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
CLIENTS: Need a way to output HttpResponseMessage before deserializing #47
Comments
I changed from using TResponse respuesta = await this.apiClient.PostContentAsync<TRequest, TResponse>(relativeUrl, content); to HttpResponseMessage httpResponse = await this.httpClient.PostAsJsonAsync<TRequest>(relativeUrl, content);
string stringResponse= await httpResponse .Content.ReadAsStringAsync();
TResponse response = JsonConvert.DeserializeObject<TResponse>(stringResponse); So, the service return the next json and the serialization with the same exact method RESTFulSense works {"codResp":"1","mensaje":"A pre-reserva MDXXXXXXXXXXX001:ILLASRNdaB2ooEG9151 non existe","numeroVisitantes":null,"fechaIda":null,"fechaVuelta":null,"infoPrereservas":null} So, I am wondering if the problem is when sending the request because serialization of "content" could be different because PostContentAsync vs PostAsJsonAsync and that difference causes the service to blow up and returns something different a json that ends on a deserialization problem. I will research on this. |
@LBoullosa Could you share here the structure of the JSON and the similar content (removing the real one) you're using to do this test? This way might be easier to identify the root cause of this issue and for other community developers to reproduce your error case-scenario. |
@jr-araujo I am thinking if perhaps the problem is related with what happen on the OpenAI session with the mediatype. Tomorrow I will take a look at it and will try with the new version released a couple of days ago. With RESTFulSense 2.9.0 fails. Something is sent from RESTFulSense different from using directly the httpClient.PostAsJsonAsync. I guess reason makes the server responses not being a json, so the deserializer at client side blows up. That´s why I want to hook and see exactly what is being returned for the RESTFulSense request. I could download source code and give it a try with my .NET 6 project, again. As I said, tomorrow I will have more details, I need a VPN to consume the API Service, i haven´t it right now. |
At least, I tested it with the new version. |
Hi!
I have a problem when posting a request to an endpoint. Deserializing the response causes
Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
It´s curious if I run the post from Postman with the exact input json I retrieved the output json. It seems correct
So I don´t know what´s trying to deserialize.
I try to import all the RESTFulSense project to debug it without success because wrong references between NetStandard RESTFulSense project conflicts with my .Net6 project so not able to compile. I tried adding some Console.WriteLine on responseString inside DeserializeResponseContent but i don´t know why something it´s blocking the messages to console. I tried too some static Action to "listen" the value from my broker but MissingMethodException at runtime.
Any suggestion?
Thanks in advance!
The text was updated successfully, but these errors were encountered: