-
Notifications
You must be signed in to change notification settings - Fork 18
Salem Ba-rabuod #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| #!/bin/bash | ||
| curl 'http://localhost:3000/users/11' \ | ||
| -X DELETE \ | ||
| -H 'Content-Type: application/json' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| #!/bin/bash | ||
| curl 'http://localhost:3000/users/11' \ | ||
| -X GET \ | ||
| -H 'Content-Type: application/json' | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| #!/bin/bash | ||
| curl 'http://localhost:3000/users/11' \ | ||
| -X PATCH \ | ||
| -H 'Content-Type: application/json' \ | ||
| -d '{"email": "johndoe@example.com"}' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #!/bin/bash | ||
| curl 'http://localhost:3000/users' \ | ||
| -X POST \ | ||
| -H 'Content-Type: application/json' \ | ||
| -d '{ | ||
| "name": "John Doe", | ||
| "email": "john.doe@example.com", | ||
| "password": "secret123", | ||
| "role": "user", | ||
| "active": true, | ||
| "department": "Engineering" | ||
| }' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| // Nobel Prize API Documentation: https://www.nobelprize.org/about/developer-zone-2/ | ||
|
|
||
| import { fetchData } from './fetcher.js'; | ||
| import { fetchData } from "./fetcher.js"; | ||
|
|
||
| const API_BASE_URL = 'https://api.nobelprize.org/2.1'; | ||
| const API_BASE_URL = "https://api.nobelprize.org/2.1"; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Your editor is set up to use double quotes for strings, whereas the original code uses single quotes. That's why we see this in the PR as a change. To avoid such unnecessary "diffs", it is important that teams agree on a common standard. |
||
|
|
||
| /** | ||
| * Fetch Nobel Prizes with optional filters | ||
|
|
@@ -15,7 +15,22 @@ const API_BASE_URL = 'https://api.nobelprize.org/2.1'; | |
| * @param {Function} onError - Callback for fetch errors | ||
| */ | ||
| export function fetchNobelPrizes(filters = {}, onSuccess, onError) { | ||
| let url = ''; // TODO Construct the full URL with query parameters; | ||
| let url = ""; | ||
| const params = new URLSearchParams(); | ||
|
|
||
| params.append("offset", filters.offset); | ||
| params.append("limit", filters.limit); | ||
| params.append("sort", "desc"); | ||
|
|
||
| if (filters.year !== "all") { | ||
| params.append("nobelPrizeYear", filters.year); | ||
| } | ||
|
|
||
| if (filters.category !== "all") { | ||
| params.append("nobelPrizeCategory", filters.category); | ||
| } | ||
|
|
||
| url = `${API_BASE_URL}/nobelPrizes?${params.toString()}`; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
|
|
||
| fetchData(url, onSuccess, onError); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are not sending any content (no body), so you don't need the
Content-Typeheader. The server simply ignores it.