2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-17 19:21:29 +03:00

docs: improve GET request example clarity in documentation. (#10836)

* Improve GET request example clarity in documentation.

Updated example GET request to use params for clarity.

* Fix indentation in GET request example

---------

Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
Himanshu Patil
2026-05-02 21:57:30 +05:30
committed by GitHub
parent 90ae1993e0
commit 050608027b
+10 -2
View File
@@ -495,8 +495,16 @@ axios
// Want to use async/await? Add the `async` keyword to your outer function/method.
async function getUser() {
try {
const response = await axios.get('/user?ID=12345');
console.log(response);
// Example: GET request with query parameters
const response = await axios.get('/user', {
params: {
ID: 12345
}
});
// Using the `params` option improves readability and automatically formats query strings
console.log(response);
} catch (error) {
console.error(error);
}