ocket8888 opened a new issue #3077: POST method on /api/1.x/federations does not work URL: https://github.com/apache/trafficcontrol/issues/3077 No matter what you put in this endpoint (provided it's valid JSON), it always returns a success while actually not doing anything. ## Example Consider a Traffic Ops instance where the only existing federation is given by this output from a `GET` request to `/api/1.4/federations`: ```json { "response": [ { "mappings": [ { "ttl": 300, "cname": "blah.blah." } ], "deliveryService": "demo1" } ]} ``` Now I send a `POST` request to that endpoint to create resolvers for this federation (logged in as the 'admin' user): ```http POST /api/1.4/federations HTTP/1.1 Host: trafficops.infra.ciab.test User-Agent: curl/7.47.0 Accept: */* Cookie: mojolicious=... Content-Length: 74 Content-Type: application/json { "deliveryService": "demo1", "resolve4": ["0.0.0.0"], "resolve6": ["::"] } ``` ... and the resulting API response: ```http HTTP/1.1 200 OK Access-Control-Allow-Credentials: true Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept Access-Control-Allow-Methods: POST,GET,OPTIONS,PUT,DELETE Access-Control-Allow-Origin: * Cache-Control: no-cache, no-store, max-age=0, must-revalidate Content-Type: application/json Date: Mon, 03 Dec 2018 16:02:00 GMT Server: Mojolicious (Perl) Set-Cookie: mojolicious=...; expires=Mon, 03 Dec 2018 20:02:00 GMT; path=/; HttpOnly Vary: Accept-Encoding Whole-Content-Sha512: dXg86uD2Un1AeBCeeBLSo2rsYgl6NOHHQEc5oMlpw1THOh2HwGdjwB3rPd/qoYIhOxcnnHoEstrEiHmucFev4A== Content-Length: 63 {"response":"admin successfully created federation resolvers."}\0 ``` but a request to `api/1.4/federations/1/federation_resolvers` shows that no such thing took place: ```json { "response": [] } ``` Note that `api/1.4/federations/1/users` shows that the 'admin' user is, in fact, associated with the federation identified by `1`: ```json { "response": [ { "fullName": null, "email": null, "id": 2, "role": "admin", "company": null, "username": "admin" } ]} ``` ### Input Doesn't Matter Even more troubling, the actual payload of the request appears to have no impact on what takes place, except that `POST`ing invalid JSON will result in an error and a large HTML document being returned to describe it. For example, sending the payload: `{"foo":"bar"}` will give the same successful message - again without actually doing anything: ```http HTTP/1.1 200 OK Access-Control-Allow-Credentials: true Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept Access-Control-Allow-Methods: POST,GET,OPTIONS,PUT,DELETE Access-Control-Allow-Origin: * Cache-Control: no-cache, no-store, max-age=0, must-revalidate Content-Type: application/json Date: Mon, 03 Dec 2018 16:03:37 GMT Server: Mojolicious (Perl) Set-Cookie: mojolicious=...; expires=Mon, 03 Dec 2018 20:02:00 GMT; path=/; HttpOnly Vary: Accept-Encoding Whole-Content-Sha512: dXg86uD2Un1AeBCeeBLSo2rsYgl6NOHHQEc5oMlpw1THOh2HwGdjwB3rPd/qoYIhOxcnnHoEstrEiHmucFev4A== Content-Length: 63 {"response": "admin successfully created federation resolvers."}\0 ``` ## Intended Behavior I'm not actually sure what this is meant to do, since the `api/1.x/federations/{{federation ID}}/federation_resolver` and `api/1.x/federation_resolvers` endpoints appear to duplicate the intent specified in the documentation. It seems like there's no real use-case for this endpoint (at least not using `POST`), and the name is unclear at any rate - I would expect it to create a federation, not a federation _resolver_.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
