mirror of
https://github.com/elyby/chrly.git
synced 2024-12-23 13:40:11 +05:30
Don't return an empty object if Mojang's textures don't contain any skin or cape
This commit is contained in:
parent
5862d1cbf6
commit
4ff164fffd
@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Fixed
|
### Fixed
|
||||||
- `ely.skinsystem.{hostname}.app.mojang_textures.usernames.iteration_size` and
|
- `ely.skinsystem.{hostname}.app.mojang_textures.usernames.iteration_size` and
|
||||||
`ely.skinsystem.{hostname}.app.mojang_textures.usernames.queue_size` are now updates even if the queue is empty.
|
`ely.skinsystem.{hostname}.app.mojang_textures.usernames.queue_size` are now updates even if the queue is empty.
|
||||||
|
- Don't return an empty object if Mojang's textures don't contain any skin or cape.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- **BREAKING**: `QUEUE_LOOP_DELAY` param is now sets as a Go duration, not milliseconds.
|
- **BREAKING**: `QUEUE_LOOP_DELAY` param is now sets as a Go duration, not milliseconds.
|
||||||
|
@ -169,7 +169,10 @@ func (ctx *Skinsystem) texturesHandler(response http.ResponseWriter, request *ht
|
|||||||
}
|
}
|
||||||
|
|
||||||
textures = texturesProp.Textures
|
textures = texturesProp.Textures
|
||||||
// TODO: return 204 in case when there is no skin and cape on mojang textures
|
if textures.Skin == nil && textures.Cape == nil {
|
||||||
|
response.WriteHeader(http.StatusNoContent)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
responseData, _ := json.Marshal(textures)
|
responseData, _ := json.Marshal(textures)
|
||||||
|
@ -455,6 +455,17 @@ var texturesTestsCases = []*skinsystemTestCase{
|
|||||||
}`, string(body))
|
}`, string(body))
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "Username not exists, but Mojang profile available, but there is no textures",
|
||||||
|
BeforeTest: func(suite *skinsystemTestSuite) {
|
||||||
|
suite.SkinsRepository.On("FindByUsername", "mock_username").Return(nil, nil)
|
||||||
|
suite.CapesRepository.On("FindByUsername", "mock_username").Return(nil, nil)
|
||||||
|
suite.MojangTexturesProvider.On("GetForUsername", "mock_username").Once().Return(createMojangResponse(false, false), nil)
|
||||||
|
},
|
||||||
|
AfterTest: func(suite *skinsystemTestSuite, response *http.Response) {
|
||||||
|
suite.Equal(204, response.StatusCode)
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Name: "Username not exists and Mojang profile unavailable",
|
Name: "Username not exists and Mojang profile unavailable",
|
||||||
BeforeTest: func(suite *skinsystemTestSuite) {
|
BeforeTest: func(suite *skinsystemTestSuite) {
|
||||||
@ -464,6 +475,8 @@ var texturesTestsCases = []*skinsystemTestCase{
|
|||||||
},
|
},
|
||||||
AfterTest: func(suite *skinsystemTestSuite, response *http.Response) {
|
AfterTest: func(suite *skinsystemTestSuite, response *http.Response) {
|
||||||
suite.Equal(204, response.StatusCode)
|
suite.Equal(204, response.StatusCode)
|
||||||
|
body, _ := ioutil.ReadAll(response.Body)
|
||||||
|
suite.Equal("", string(body))
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user