jupyter-server / jupyter_server

The backend—i.e. core services, APIs, and REST endpoints—to Jupyter web applications.
https://jupyter-server.readthedocs.io
BSD 3-Clause "New" or "Revised" License
484 stars 295 forks source link

Implement ContentsHandler's head request. #1327

Open Carreau opened 1 year ago

Carreau commented 1 year ago

See https://github.com/jupyterlab/jupyterlab/issues/15153 in JupyterLab.

A few places might make use of HEAD request to check that a content does (or does not) exists without actually get the full content. Typically Save-As to show overwrite confirmation or not.

I think a blanket implementation that itself calls get but discard the body is the simpler to keep compatibility with subclasses.

Zsailer commented 11 months ago

I think a blanket implementation that itself calls get but discard the body is the simpler to keep compatibility with subclasses.

This already exists in Jupyter Server today. The client can use a query parameter content=0 when calling get in the contents service to get a response without content.

We should update the JupyterLab code to use this API on SaveAs.

Carreau commented 11 months ago

It is weird to pass it as a parameter if there is an official HEAD request in the rest spec. I'm not sure which effects it can have on proxies.

also the code you link should likely turn the result into a bool and not an int, but i'm in mobile Incan't dig more.

On Thu, Oct 12, 2023 at 17:36 Zachary Sailer @.***> wrote:

I think a blanket implementation that itself calls get but discard the body is the simpler to keep compatibility with subclasses.

This already exists in Jupyter Server today. The client can use a query parameter content=0 https://github.com/jupyter-server/jupyter_server/blob/1ece796301b185d69e2173a303487966585b5356/jupyter_server/services/contents/handlers.py#L113 when calling get in the contents service to get a response without content.

We should update the JupyterLab code to use this API on SaveAs.

— Reply to this email directly, view it on GitHub https://github.com/jupyter-server/jupyter_server/issues/1327#issuecomment-1759868219, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACR5T6HQWQ44DGAQYAG3GLX7AFBNANCNFSM6AAAAAA5EIRQDU . You are receiving this because you authored the thread.Message ID: @.***>