зеркало из https://github.com/Azure/AzureGraph.git
better header processing
This commit is contained in:
Родитель
8f8cc5e3de
Коммит
90339de8b2
|
@ -1,6 +1,6 @@
|
|||
Package: AzureGraph
|
||||
Title: Simple Interface to 'Microsoft Graph'
|
||||
Version: 1.0.3
|
||||
Version: 1.0.3.9000
|
||||
Authors@R: c(
|
||||
person("Hong", "Ooi", , "hongooi@microsoft.com", role = c("aut", "cre")),
|
||||
person("Microsoft", role="cph")
|
||||
|
@ -13,7 +13,7 @@ VignetteBuilder: knitr
|
|||
Depends:
|
||||
R (>= 3.3)
|
||||
Imports:
|
||||
AzureAuth,
|
||||
AzureAuth (>= 1.0.1),
|
||||
utils,
|
||||
httr (>= 1.3),
|
||||
jsonlite,
|
||||
|
|
4
NEWS.md
4
NEWS.md
|
@ -1,3 +1,7 @@
|
|||
# AzureGraph 1.0.3.9000
|
||||
|
||||
- Minor bug fixes.
|
||||
|
||||
# AzureGraph 1.0.3
|
||||
|
||||
- Improved handling of null object properties.
|
||||
|
|
|
@ -41,7 +41,7 @@ call_graph_url <- function(token, url, ..., body=NULL, encode="json",
|
|||
http_status_handler=c("stop", "warn", "message", "pass"),
|
||||
auto_refresh=TRUE)
|
||||
{
|
||||
headers <- process_headers(token, ..., encode=encode, auto_refresh=auto_refresh)
|
||||
headers <- process_headers(token, auto_refresh)
|
||||
|
||||
# if content-type is json, serialize it manually to ensure proper handling of nulls
|
||||
if(encode == "json" && !is_empty(body))
|
||||
|
@ -58,7 +58,7 @@ call_graph_url <- function(token, url, ..., body=NULL, encode="json",
|
|||
}
|
||||
|
||||
|
||||
process_headers <- function(token, ..., auto_refresh)
|
||||
process_headers <- function(token, auto_refresh)
|
||||
{
|
||||
# if token has expired, renew it
|
||||
if(auto_refresh && !token$validate())
|
||||
|
@ -67,8 +67,8 @@ process_headers <- function(token, ..., auto_refresh)
|
|||
token$refresh()
|
||||
}
|
||||
|
||||
host <- httr::parse_url(if(token$version == 1) token$resource else token$scope[1])$hostname
|
||||
creds <- token$credentials
|
||||
host <- httr::parse_url(AzureAuth::decode_jwt(creds$access_token)$payload$aud)$hostname
|
||||
headers <- c(
|
||||
Host=host,
|
||||
Authorization=paste(creds$token_type, creds$access_token),
|
||||
|
|
Загрузка…
Ссылка в новой задаче