Add GET /api/v1/character/details with each image's change time
Returns every character image with when it was last changed, in Unix seconds, so clients can cache the images and download only the ones that changed.
This commit is contained in:
1 parent
76a1b946eb
commit
c62b65d7cd
5 files changed
+72
No files matched your search
@@ -167,6 +167,16 @@ func TestCharacterEndpoints(t *testing.T) {
|
||||
require.NoError(t, json.Unmarshal(e.do(http.MethodGet, "/api/v1/character/list").Body.Bytes(), &list))
|
||||
assert.Equal(t, []string{"Adol.png", "Aloy.jpg"}, list)
|
||||
|
||||
var details []struct {
|
||||
Name string `json:"name"`
|
||||
Modified int64 `json:"modified"`
|
||||
}
|
||||
require.NoError(t, json.Unmarshal(e.do(http.MethodGet, "/api/v1/character/details").Body.Bytes(), &details))
|
||||
require.Len(t, details, 2)
|
||||
assert.Equal(t, "Adol.png", details[0].Name)
|
||||
assert.Equal(t, "Aloy.jpg", details[1].Name)
|
||||
assert.Positive(t, details[0].Modified)
|
||||
|
||||
rec := e.do(http.MethodGet, "/api/v1/character?name=Adol.png")
|
||||
assert.Equal(t, http.StatusOK, rec.Code)
|
||||
assert.Equal(t, "image/png", rec.Header().Get("Content-Type"))
|
||||
|
||||
Reference in new issue
Block a user