Could we set the default handling for mime type "application/json+geo" to be the same as for "application/ json" so it does not need to be specified manually? Or even more general, does it make sense to strip away the "+..." always before deciding how to parse the output, so all "json+xyz" would fall back to "json"?
response <- httr::GET("https://api3.geo.admin.ch/rest/services/all/MapServer/identify?geometry=2679593.28515719,1249208.93603668&geometryType=esriGeometryPoint&layers=all:ch.are.bauzonen&mapExtent=312250,-77500,1007750,457500&imageDisplay=1391,1070,96&lang=de&tolerance=0&geometryFormat=geojson&sr=2056")
response
#> Response [https://api3.geo.admin.ch/rest/services/all/MapServer/identify?geometry=2679593.28515719,1249208.93603668&geometryType=esriGeometryPoint&layers=all:ch.are.bauzonen&mapExtent=312250,-77500,1007750,457500&imageDisplay=1391,1070,96&lang=de&tolerance=0&geometryFormat=geojson&sr=2056]
#> Date: 2019-10-16 08:25
#> Status: 200
#> Content-Type: application/geo+json
#> Size: 4.94 kB
#> <BINARY BODY>
head(httr::content(response))
#> [1] 7b 22 72 65 73 75
str(httr::content(response, as = "parsed", type = "application/json"), max.level = 3)
#> List of 1
#> $ results:List of 1
#> ..$ :List of 8
#> .. ..$ geometry :List of 2
#> .. ..$ layerBodId: chr "ch.are.bauzonen"
#> .. ..$ bbox :List of 4
#> .. ..$ featureId : int 18642
#> .. ..$ layerName : chr "Bauzonen Schweiz (harmonisiert)"
#> .. ..$ type : chr "Feature"
#> .. ..$ id : int 18642
#> .. ..$ properties:List of 9
Could we set the default handling for mime type "application/json+geo" to be the same as for "application/ json" so it does not need to be specified manually? Or even more general, does it make sense to strip away the "+..." always before deciding how to parse the output, so all "json+xyz" would fall back to "json"?
Created on 2019-10-16 by the reprex package (v0.3.0)