Skip to content

Commit 90635a7

Browse files
gpocentekJohnVillalovos
authored andcommitted
feat(api): implement HEAD method
1 parent 8f8611a commit 90635a7

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

gitlab/client.py

+21
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,27 @@ def http_get(
805805
else:
806806
return result
807807

808+
def http_head(
809+
self, path: str, query_data: Optional[Dict[str, Any]] = None, **kwargs: Any
810+
) -> requests.structures.CaseInsensitiveDict:
811+
"""Make a HEAD request to the Gitlab server.
812+
813+
Args:
814+
path: Path or full URL to query ('/projects' or
815+
'http://whatever/v4/api/projecs')
816+
query_data: Data to send as query parameters
817+
**kwargs: Extra options to send to the server (e.g. sudo, page,
818+
per_page)
819+
Returns:
820+
A requests.header object
821+
Raises:
822+
GitlabHttpError: When the return code is not 2xx
823+
"""
824+
825+
query_data = query_data or {}
826+
result = self.http_request("head", path, query_data=query_data, **kwargs)
827+
return result.headers
828+
808829
def http_list(
809830
self,
810831
path: str,

0 commit comments

Comments
 (0)