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

Use 402 status code and update tests. #295

Closed

Conversation

yzernik
Copy link
Contributor

@yzernik yzernik commented Mar 3, 2022

Use status code 402 when a file requires payment.

From Mozilla:

The HTTP 402 Payment Required is a nonstandard response status code that is reserved for future use. This status code was created to enable digital cash or (micro) payment systems and would indicate that the requested content is not available until the client makes a payment.

Sometimes, this status code indicates that the request cannot be processed until the client makes a payment. However, no standard use convention exists and different entities use it in different contexts.

@casey
Copy link
Collaborator

casey commented Mar 3, 2022

We actually thought about this, but then elected not to do it. If I recall, our thinking was that there isn't any HTTP client software out there that will actually do anything useful in response to a 402. In particular, there isn't any software that will prompt the user to pay in response to a 402, and no way to deliver along with a 402 instructions for how to make the payment. In addition, some software, like HTTP clients, might misbehave if they get an unexpected status code. I'd definitely be open for returning 402s if it actually did something useful, but at the moment I don't think it's a benefit.

@yzernik
Copy link
Contributor Author

yzernik commented Mar 4, 2022

That makes sense.

In the future, it might be worth revisiting if the WebLN spec or browser extensions like Joule standardize 402 error handling.

@yzernik yzernik closed this Mar 4, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants