Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Http response error can't be different of 404 #17

Closed
jcourtat opened this issue Jun 27, 2017 · 4 comments
Closed

Http response error can't be different of 404 #17

jcourtat opened this issue Jun 27, 2017 · 4 comments

Comments

@jcourtat
Copy link
Contributor

Hello,
thanks for you work on this library.
I don't see how to build a response with the error code i want and the content i want.
when i return false in the getPage() method, libnavajo automatically set HTTP error code to 404 and a default body with HTML is set in the body response.
Am i right ?
If this is the case, would you agree on a patch permitting such configuration ?

regards

Julien

@titi38
Copy link
Owner

titi38 commented Jul 1, 2017

Hello,
It's a very relevant remark. I will add soon a method into the HttpResponse object to set the http return code (default 200). Thus, you will be able to return the page you want, with the http code of your dream ;-)
I'll close the ticket as soon as it will be fully implemented and tested.
Cheers
Thierry

@titi38
Copy link
Owner

titi38 commented Jul 2, 2017

Hi,

I just push a new version that should do the job.

2 new methods are available in the httpResponse:
void setHttpReturnCode(unsigned value, const std::string message)
and
void setHttpReturnCode(unsigned value) // for standart http return code (the message is guest by searching through a given list of official return codes)

By default, http return code is set to 200, and message is "OK"...

Cheers,
Thierry

@titi38 titi38 closed this as completed Jul 2, 2017
@jcourtat
Copy link
Contributor Author

jcourtat commented Jul 4, 2017

Hello, thank you for your work!
I may be wrong, but after removing an url using dynamicRepository->remove(url), i can still access it and enter code within getPage().
Before your enhancement, it was responding error 404 which was the good code, and did not enter getPage().

regards

Julien

@titi38
Copy link
Owner

titi38 commented Jul 5, 2017

Hello,
You were right ! It should be fixed... Could you confirm ? Thanks a lot...
Cheers,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants