1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-01 12:24:14 +01:00

Add user agent in the connection to api-builder.arduino.cc/builder/v1/boards/

This commit is contained in:
Mattia Bertorello 2019-04-01 10:16:42 +02:00 committed by Cristian Maglie
parent 05de5c9593
commit eb055cc4c0

View File

@ -208,6 +208,9 @@ public class Platform {
try {
URL jsonUrl = new URL("http", "api-builder.arduino.cc", 80, "/builder/v1/boards/0x"+vid+"/0x"+pid);
URLConnection connection = jsonUrl.openConnection();
String userAgent = "ArduinoIDE/" + BaseNoGui.VERSION_NAME + " Java/"
+ System.getProperty("java.version");
connection.setRequestProperty("User-agent", userAgent);
connection.connect();
HttpURLConnection httpConnection = (HttpURLConnection) connection;
int code = httpConnection.getResponseCode();