Skip to content

POST responseStatusCode Hangs #55

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

Open
markreha opened this issue Feb 9, 2019 · 0 comments
Open

POST responseStatusCode Hangs #55

markreha opened this issue Feb 9, 2019 · 0 comments
Assignees

Comments

@markreha
Copy link

markreha commented Feb 9, 2019

I am using an Arduino UnO Wifi R2. The following code hangs on my Arduino on the call to responseStatusCode() after running my application anywhere from 12-56 hrs. My HTTP endpoint is a REST API using Java Spring Framework deployed on major Cloud Servers. The hang happens against multiple Cloud Servers that includes Azure, Google, Heroku, and AWS. My JSON payload is very small and I have validated I have no memory leaks in my program. The same REST API and backend code has been running with a Raspberry Pi for almost 12 months.

// Send POST request with JSON to Cloud REST API
HttpClient client = HttpClient(wifi, serverAddress, port);
client.setHttpResponseTimeout(60 * 1000);
client.beginRequest();
client.post(uri);
client.sendBasicAuth("MyUsername", "MyPassword");
client.sendHeader("Content-Type", "application/json");
client.sendHeader("Content-Length", json.length());
client.beginBody();
client.print(json);
client.endRequest();

// Read the status code and body of the response
int statusCode = client.responseStatusCode();
String response = client.responseBody();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants