Local Storage vs Cookies

Cookies and local storage serve different purposes. Cookies are primarily for reading server-side, local storage can only be read by the client-side. So the question is, in your app, who needs this data — the client or the server? If it’s your client (your JavaScript), then by all means switch. You’re wasting bandwidth by sending … Read more

How do you make a HTTP request with C++?

I had the same problem. libcurl is really complete. There is a C++ wrapper curlpp that might interest you as you ask for a C++ library. neon is another interesting C library that also support WebDAV. curlpp seems natural if you use C++. There are many examples provided in the source distribution. To get the … Read more

How to make an HTTP POST web request

There are several ways to perform HTTP GET and POST requests: Method A: HttpClient (Preferred) Available in: .NET Framework 4.5+, .NET Standard 1.1+, .NET Core 1.0+ . It is currently the preferred approach, and is asynchronous and high performance. Use the built-in version in most cases, but for very old platforms there is a NuGet package. Setup It is recommended to instantiate one HttpClient for your application’s … Read more

What are all the possible values for HTTP “Content-Type” header?

You can find every content type here: http://www.iana.org/assignments/media-types/media-types.xhtml The most common type are: Type applicationapplication/java-archive application/EDI-X12 application/EDIFACT application/javascript application/octet-stream application/ogg application/pdf application/xhtml+xml application/x-shockwave-flash application/json application/ld+json application/xml application/zip application/x-www-form-urlencoded Type audioaudio/mpeg audio/x-ms-wma audio/vnd.rn-realaudio audio/x-wav Type imageimage/gif image/jpeg image/png image/tiff image/vnd.microsoft.icon image/x-icon image/vnd.djvu image/svg+xml Type multipartmultipart/mixed multipart/alternative multipart/related (using by MHTML (HTML mail).) multipart/form-data Type texttext/css text/csv text/html … Read more

How is an HTTP POST request made in node.js?

Here’s an example of using node.js to make a POST request to the Google Compiler API: I’ve updated the code to show how to post data from a file, instead of the hardcoded string. It uses the async fs.readFile command to achieve this, posting the actual code after a successful read. If there’s an error, it is … Read more

How to use java.net.URLConnection to fire and handle HTTP requests

First a disclaimer beforehand: the posted code snippets are all basic examples. You’ll need to handle trivial IOExceptions and RuntimeExceptions like NullPointerException, ArrayIndexOutOfBoundsException and consorts yourself. In case you’re developing for Android instead of Java, note also that since introduction of API level 28, cleartext HTTP requests are disabled by default. You are encouraged to use HttpsURLConnection, but if it is really … Read more