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

HTML output in raiden RestApi #1261

Closed
palango opened this Issue Feb 20, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@palango
Collaborator

palango commented Feb 20, 2018

Problem Definition

I just tested the Raiden RestApi with the following request:

curl http://127.0.0.1:5001/api/1/token/0x2a65aca4d5fc5b5c859090a6c34d164135398226
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>404 Not Found</title>
<h1>Not Found</h1>
<p>The requested URL was not found on the server.  If you entered the URL manually please check your spelling and try again.</p>

The route doesn't seem to exist and so some error handler is called that returns HTML. I'd expect something like the following json:

{"error": "endpoint not found."}

System Description

Darwin yoda 17.4.0 Darwin Kernel Version 17.4.0: Sun Dec 17 09:19:54 PST 2017; root:xnu-4570.41.2~1/RELEASE_X86_64 x86_64
/usr/local/bin/solc
solc, the solidity compiler commandline interface
Version: 0.4.20+commit.3155dd80.Darwin.appleclang
/usr/local/bin/geth

Geth
Version: 1.8.1-stable
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.10
Operating System: darwin
GOPATH=
GOROOT=/usr/local/opt/go/libexec
fd05f7fa13f2233332d06e308ae55137fc97ef42
@LefterisJP

This comment has been minimized.

Collaborator

LefterisJP commented Feb 20, 2018

Why? That is not a correct endpoint so you get a 404. Do you propose to instead always return such an error when an endpoint is wrong?

@palango

This comment has been minimized.

Collaborator

palango commented Feb 20, 2018

Main point is that I expect JSON, it should still return a 404, but not HTML.

If I try to get requests from a non-existent token I get an error in JSON:

curl http://127.0.0.1:5001/api/1/events/tokens/0x2a65aca4d5fc5b5c859090a6c34d164135398226
{"errors": "The token address is not registered."}
@LefterisJP

This comment has been minimized.

Collaborator

LefterisJP commented Feb 20, 2018

I see. I know how to fix this. Let me do it quick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment