-
Notifications
You must be signed in to change notification settings - Fork 0
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
Media endpoint should allow async processing #7
Comments
I wonder if not allowing |
Like you, @nolith, my site is also statically generated so I cannot serve assets immediately without my adding a way of hosting images external to my blog. I agree with @manton that an application might want to preview a URL but I think there is room for both a 202 and 201 response to be given. Thus, clients that support previewing would want to send a 201 response and clients that do not would send a 202 response. |
One issue with allowing 202 Accepted responses is that this might mean content is served without an image in some cases (for instance, where an image is slower to upload than the post). This would be the case for my setup (as uploading photos and posts happen in separate commits as the media endpoint is independent from the rest of my Micropub endpoint) but the gap has thus far been so small I have not noticed. |
This mostly comes up with git workflows, so would it be wrong to respond 201 as soon as your commit is successful, even if the build process hasn't happened? The URL should still be known, so you can respond with a 201 and Location, the image was successfully committed to the repo. A client that tries to fetch the image will get a 404 though, but only until the CI process is completed. |
Yeah. That's the workflow I go through:
|
Micropub specs allows for a
202 Accepted
answer for creating a newh-entry
, as explained in 3.3.6 Response:But the Media Endpoint only allows for a
201 Created
answer, as explained in 3.6.4 Response.I propose we extend the usage of
202 Accepted
to the media endpoint to make static site generators compliant with the spec.Just to give an example of my setup: my blog is statically generated in CI, and my micropub server is a stateless container that converts incoming requests into git commits, those commits in turn triggers my CI and the blog is published.
With such enviroment it will be not possible to make the image immediately available.
(Originally published at: https://l0g.in/5EKG00)
The text was updated successfully, but these errors were encountered: