Created an HTTP request library - can I get it listed

Hello:

I've created a small library for making HTTP Requests.

I'm wondering what I should do to get some review and if it deemed worthy getting it listed on the "Libraries" section of the Reference area of the site.

Thanks!

Cheers,
csquared

most new libraries are 3rd party libraries, seldom they are part of the core libs. They don't need to.

Best you can do is create an article on the playground, describing your library, how it is used, how it works etc.
Link this playground page to this thread where you can discuss improvements, remarks and complaints etc.
example - Arduino Playground - DHTLib - one of the many DHT libs around, so no core lib

I looked at the test script you posted and I would propose some changes, as the current interface let me type too much :wink:

I rewrote the core of your test sketch so you can get the idea

  • removed default values of .get()
  • added a .getHeader()
  • removed default value of .post()
void loop(){

  Serial.println("Test GET with path");
  test_connect(heroku.get());

  Serial.println("Test GET with path and respnose");
  test_connect(heroku.get(&response));
  test_response();

  Serial.println("Test GET with path and headers");
  test_connect(heroku.getHeader(headers, 1));

  Serial.println("Test GET with path and headers and response");
  test_connect(heroku.getHeader(headers, 1, &response));
  test_response();

  Serial.println("Test POST with path and body");
  test_connect(heroku.post(post_body));

  Serial.println("Test POST with path and body and response");
  test_connect(heroku.post(post_body, &response));
  test_response();

  Serial.println("Test POST with path and body and headers");
  test_connect(heroku.post(post_body, headers, 1));

  Serial.println("Test POST with path and body and headers and response");
  test_connect(heroku.post(post_body, headers, 1, &response));
  test_response();
}

I did not look at the implementation, but I see you use the String Class as parameter. The String class is heavily discussed on this forum because it had memory problems.
For embedded systems like Arduino, dynamic allocation of memory like in the String class can have unwanted side effects like fragmented memory.
You might consider rewriting the class not using Strings but char* instead.

Ah - thanks for the link to the playground section, that's what I was looking for.

I'll also take some time to get rid of as many String objects as I can and replace them with char*s.

I think your rewrite of the test is missing a large point of the purpose of the library-- that you can connect to any url instead of a hardcoded one.
FWIW, I don't think its too much typing to specify that :wink:

Though I do think I could improve the interface by giving the HTTP object a setHeader command so you can set headers one at a time instead of passing in an array of strings.

Thanks for the feedback!

Just made the updates: