The Microsoft Graph API has some curious endpoints, one of which requires the use of colon (:)
GET /sites/{hostname}:/{server-relative-path}
https://learn.microsoft.com/en-us/graph/api/site-get?view=graph-rest-1.0&tabs=http#access-a-site-by-server-relative-url
req_template fails miserable, as it believes the template uses colon-placeholders - not curly bracket placeholders:
req_template(request("http://example.http.com"), "/sites/{hostname}:/{server-relative-path}")
Error in env_has(env, name, inherit = TRUE) :
attempt to use zero-length variable name
Suggested solutions:
- Document this behaviour, most do.
- In
template_type swap two first if conditions, so curly brackets are checked first, then brackets. Downside: Using a template without placeholders, but with a colon in the path will still fail.
- Check for
:\\w+ in the grepl for colon, instead of just :.
I'll gladly make the changes and make a pull request.
The Microsoft Graph API has some curious endpoints, one of which requires the use of colon (
:)https://learn.microsoft.com/en-us/graph/api/site-get?view=graph-rest-1.0&tabs=http#access-a-site-by-server-relative-url
req_templatefails miserable, as it believes the template uses colon-placeholders - not curly bracket placeholders:Suggested solutions:
template_typeswap two first if conditions, so curly brackets are checked first, then brackets. Downside: Using a template without placeholders, but with a colon in the path will still fail.:\\w+in the grepl for colon, instead of just:.I'll gladly make the changes and make a pull request.