Refactor HTTP client test samples and configuration

- Moved HTTP client test files to `internal/requests`.
- Replaced hardcoded `localhost` URLs with `{{base_url}}`.
- Updated `http-client.env.json` to include `base_url` configuration.
This commit is contained in:
siyahas 2025-09-08 16:34:23 +03:00
parent 5aa6a96b1d
commit 7d4bf481c9
2 changed files with 11 additions and 10 deletions

View file

@ -1,23 +1,23 @@
### Films API sample requests (IntelliJ HTTP Client) ### Films API sample requests (IntelliJ HTTP Client)
### List films (default pagination) ### List films (default pagination)
GET http://localhost:8080/films GET http://{{base_url}}/films
Accept: application/hal+json Accept: application/hal+json
### List films with expand and filters ### List films with expand and filters
GET http://localhost:8080/films?limit=5&offset=0&expand=actors,language&language.name=English GET http://{{base_url}}/films?limit=5&offset=0&expand=actors,language&language.name=English
Accept: application/hal+json Accept: application/hal+json
### List films filtered by category name ### List films filtered by category name
GET http://localhost:8080/films?limit=5&category.name=Action GET http://{{base_url}}/films?limit=5&category.name=Action
Accept: application/hal+json Accept: application/hal+json
### Get a single film ### Get a single film
GET http://localhost:8080/films/1?expand=actors,language,original_language GET http://{{base_url}}/films/1?expand=actors,language,original_language
Accept: application/hal+json Accept: application/hal+json
### Create a film (server computes next film_id) ### Create a film (server computes next film_id)
POST http://localhost:8080/films POST http://{{base_url}}/films
Content-Type: application/json Content-Type: application/json
Accept: application/hal+json Accept: application/hal+json
@ -35,7 +35,7 @@ Accept: application/hal+json
} }
### Create a film with explicit film_id ### Create a film with explicit film_id
POST http://localhost:8080/films POST http://{{base_url}}/films
Content-Type: application/json Content-Type: application/json
Accept: application/hal+json Accept: application/hal+json
@ -47,7 +47,7 @@ Accept: application/hal+json
### Replace film (PUT) ### Replace film (PUT)
# Note: Replace the :id variable below to match an existing film id # Note: Replace the :id variable below to match an existing film id
PUT http://localhost:8080/films/{{film_id}} PUT http://{{base_url}}/films/{{film_id}}
Content-Type: application/json Content-Type: application/json
Accept: application/hal+json Accept: application/hal+json
@ -66,7 +66,7 @@ Accept: application/hal+json
} }
### Patch film (partial update) ### Patch film (partial update)
PATCH http://localhost:8080/films/{{film_id}} PATCH http://{{base_url}}/films/{{film_id}}
Content-Type: application/json Content-Type: application/json
Accept: application/hal+json Accept: application/hal+json
@ -76,8 +76,8 @@ Accept: application/hal+json
} }
### Delete film ### Delete film
DELETE http://localhost:8080/films/{{film_id}} DELETE http://{{base_url}}/films/{{film_id}}
### Related: list actors of a film ### Related: list actors of a film
GET http://localhost:8080/films/{{film_id}}/actors GET http://{{base_url}}/films/{{film_id}}/actors
Accept: application/hal+json Accept: application/hal+json

View file

@ -1,5 +1,6 @@
{ {
"dev": { "dev": {
"base_url": "localhost:8080",
"film_id": "10001" "film_id": "10001"
} }
} }