curl scripts to simulate GET, POST, DELETE, and PUT request (method) calls to my Play Framework REST/RESTful web services.
Here are three nice diagrams drawn by Mariko Kosaka that explain HTTP and HTTP2.
If you ever need to work with HTTP request headers in a Play Framework application, I hope the following examples will help. I was just looking at trying to access request headers like “User-Agent” and “Referer,” and ran a few tests.
Note: I put all of the Scala code that follows in Play Framework controller actions, then accessed the URL that was associated with those actions in the Play routes file, using the latest version of the Firefox browser on a MacOS system.
Play Framework FAQ: How do I set the Play Framework 2.6 port in production mode?
You set the port that your Play Framework application listens on by passing the
http.port parameter to the “run” script for your application:
Here’s an example of a command I use to execute the run script for a Play Framework application named myapp:
deelay.me looks like a good website to use if you’re writing network-access code and want to simulate accessing a slow web server.
July 22, 2017 will go down as the day I (finally) switched this website to using HTTPS instead of HTTP. (See the padlock icon in the URL field of your browser.) I’ve been using a self-signed certificate to log in to this site for a long time, but yesterday I finally switched to “HTTPS for everyone.”
Curl FAQ: How do I use curl to get the headers from a website URL?
Short answer: Use curl's
-I option, like this:
$ curl -I URL
Here's a specific example, including a real URL and results:
If you ever need some good ScalaJ-HTTP examples, see the test files in the project, including this HttpBinTest.scala file. That file currently shows a number of good ScalaJ-HTTP examples, including GET, POST, redirect examples with Scala.
See that page for a full list of examples, but for my own use, here are a few of them.