Skip to content

Commit

Permalink
Fix conflict after pull from develop
Browse files Browse the repository at this point in the history
Merge branch 'develop' of https://github.com/rte-antares-rpackage/antaresRead into ant1649

# Conflicts:
#	NEWS.md
  • Loading branch information
kemihak committed May 13, 2024
2 parents 79dec6d + cb61dbd commit d137abf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
11 changes: 2 additions & 9 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,12 @@
# antaresRead 2.6.2 (development)

NEW FEATURES :

BUGFIXES :
* `readIniFile()` : avoid `utils::type.convert` on specific cases (ex : 789e or 123i)

BREAKING CHANGES :

DATA :

PERFORMANCE :
* `api_get()` add encoding argument to pass to `httr::content()`


# antaresRead 2.6.1
# antaresRead 2.6.1

BUGFIXES :

Expand Down
11 changes: 7 additions & 4 deletions R/API-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#' @param ... Additional arguments passed to API method.
#' @param default_endpoint Default endpoint to use.
#' @param parse_result `character` options for parameter `as` of function [httr::content()]
#' @param encoding argument to pass as argument to the function [httr::content()]
#' @param opts Antares simulation options or a `list` with an `host = ` slot.
#'
#' @return Response from the API.
Expand All @@ -24,16 +25,18 @@
#' endpoint = NULL,
#' parse_result = NULL)
#'
#' # you can force parse options as text
#' # you can force parse options as text and encoding to UTF-8
#' api_get(opts = list(host = "http://0.0.0.0:8080"),
#' endpoint = NULL,
#' parse_result = "text")
#' parse_result = "text",
#' encoding = "UTF-8")
#'
#' }
api_get <- function(opts,
endpoint, ...,
default_endpoint = "v1/studies",
parse_result = NULL) {
parse_result = NULL,
encoding = NULL) {
if (inherits(endpoint, "AsIs")) {
opts$host <- endpoint
endpoint <- NULL
Expand Down Expand Up @@ -74,7 +77,7 @@ api_get <- function(opts,
stop_for_status(result, task = mess_error)
}else
warn_for_status(result)
content(result, as = parse_result)
content(result, as = parse_result, encoding = encoding)
}

#' @export
Expand Down
10 changes: 7 additions & 3 deletions man/API-methods.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d137abf

Please sign in to comment.