fix(pronoundb): set a user-agent on outgoing requests

This commit is contained in:
Ashhhleyyy 2022-07-17 19:39:42 +01:00
parent 4dbd0ee8f8
commit 12d3785f95
Signed by: ash
GPG key ID: 83B789081A0878FB

View file

@ -36,6 +36,8 @@ import java.util.Objects;
public class PlayerPronouns implements ModInitializer {
public static final Logger LOGGER = LoggerFactory.getLogger(PlayerPronouns.class);
public static final String MOD_ID = "playerpronouns";
private static final String USER_AGENT = "player-pronouns/1.0 (+https://ashhhleyyy.dev/projects/2021/player-pronouns)";
private static final Map<String, String> PRONOUNDB_ID_MAP = new HashMap<>() {{
// short pronoun set identifier map from https://pronoundb.org/docs
put("hh", "he/him");
@ -107,6 +109,7 @@ public class PlayerPronouns implements ModInitializer {
.build();
var req = HttpRequest.newBuilder()
.uri(new URI(pronounDbUrl))
.header("User-Agent", USER_AGENT)
.GET()
.timeout(Duration.ofSeconds(10))
.build();