You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(client): move the POST request in the client guide to a new page
Add a new page to the "Getting Started with a Client" guide that
demonstrates how to make POST requests using hyper. The new section
includes examples for sending plain text, binary data, and JSON in
the request body, along with appropriate Content-Type headers.
This addition helps users understand how to construct and send POST
requests, complementing the existing GET request example.
Now that we've seen how to make a GET request, let's look at how to make a POST request. This is useful when you need to send data to the server, such as when submitting a form or uploading a file.
8
+
9
+
To make a POST request, we'll need to change a few things from our GET request:
10
+
11
+
1. We'll set the method to POST.
12
+
2. We'll need to provide a request body.
13
+
3. We'll need to specify the type of data in our body by adding a `hyper::header::CONTENT_TYPE` header.
14
+
15
+
For the body, we have a couple of options. We can use a simple string, a JSON string, or we can use raw bytes. Let's look at all three:
Now that we've seen how to make a GET request, let's look at how to make a POST request. This is useful when you need to send data to the server, such as when submitting a form or uploading a file.
178
-
179
-
To make a POST request, we'll need to change a few things from our GET request:
180
-
181
-
1. We'll set the method to POST.
182
-
2. We'll need to provide a request body.
183
-
3. We'll need to specify the type of data in our body by adding a `hyper::header::CONTENT_TYPE` header.
184
-
185
-
For the body, we have a couple of options. We can use a simple string, a JSON string, or we can use raw bytes. Let's look at all three:
0 commit comments