Closed BrickXu closed 9 years ago
Actually this is still happening on v0.10.0-RC3:
$ curl 'http://localhost:8080/v2/apps/sleeper/tasks/'
sleeper 172.18.6.104 172.18.6.104
$ curl 'http://localhost:8080/v2/apps/sleeper/tasks/' -H "Accept: application/json"
{"tasks":[{"appId":"/sleeper","id":"sleeper.1c5789ef-3128-11e5-8f1f-ac87a33a1422","host":"172.18.6.104","ports":[],"startedAt":"2015-07-23T10:46:44.924Z","stagedAt":"2015-07-23T10:46:44.862Z","version":"2015-07-23T10:42:14.631Z"},{"appId":"/sleeper","id":"sleeper.1f542820-3128-11e5-8f1f-ac87a33a1422","host":"172.18.6.104","ports":[],"startedAt":"2015-07-23T10:46:49.936Z","stagedAt":"2015-07-23T10:46:49.873Z","version":"2015-07-23T10:42:14.631Z"}]}%
If you use curl, it always sets the Accept
header. If you do not specify anything explicitly, it will use Accept: */*
.
The SetRequestDefaultsFilter
will only set the Accept header if it was not set before. In the case of Accept: */*
it will leave in untouched.
Our routing logic then seems to determine the preference between the different implementation which only differ in their values of the @Produces
logic on startup. Thus, if you just restart Marathon often enough, you will get to the state which consistently uses text/plain
to answer the above request.
It sucks that this seems to be determined at random on startup.
Hi all,
I found that
v2/tasks
must set the request header withAccept: application/json
to get the json format response, or the marathon will return plain text.But for the
v2/apps
, it always return json format response withoutAccept: application/json
. I think the APIs must keep the same behavior when the request with or withoutAccept: application/json
ENV: