oduwsdl / MemGator

A Memento Aggregator CLI and Server in Go
https://memgator.cs.odu.edu/api.html
MIT License
55 stars 11 forks source link

Report MemGator version when querying the root URI in server mode #57

Closed machawk1 closed 8 years ago

machawk1 commented 8 years ago

MemGator 1.0-RC3 reports the X-Generator HTTP header only when a query is performed on a URI-R and not on the service's root, where guidance for further querying format is reported in the HTTP response body.

For example, when I curl -I mymemgatordeployment:1208/timemap/json/http://odu.edu, I am returned the HTTP Header (among other content) X-Generator: MemGator:1.0-rc3. When I curl -I mymemgatordeployment:1208, this header is absent.

I believe it would be useful for other services that use MemGator to be able to quickly obtain the version of MemGator deployed without having to query using a URI-R.

ibnesayeed commented 8 years ago

Yes, I agree and I would probably also add the ASCII art with other stuff in the payload for the root URI.

machawk1 commented 8 years ago

@ibnesayeed adding the ASCII art would make the default HTTP response a bit larger than it currently is. 0552257b0fccee3d08490dc4099757a08332a826 adds the header per this ticket but I did not merge due to my unfamiliarity with the coding style. Please have a look before merging.

ibnesayeed commented 8 years ago

@ibnesayeed adding the ASCII art would make the default HTTP response a bit larger than it currently is.

Eventually, that page is going to be replaced with a more detailed documentation and splash page, so saving a few bytes is perhaps not going to be too impressive.

0552257 adds the header per this ticket but I did not merge due to my unfamiliarity with the coding style. Please have a look before merging.

Seems good to me for now. Though we perhaps need to move that header up (during refactoring), so that it can be added globally, not in the two branches separately which leads to duplicate code.

machawk1 commented 8 years ago

Agreed. This was a one-off fix that adds duplication. There is a bit more duplication in the code that we can refactor. I'll merge the code and close this issue.