Skip to content

Commit 084c8b5

Browse files
authored
Include version header when sending HTTP requests (#28)
1 parent 8f52f61 commit 084c8b5

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ pomName=Authsignal Server SDK for Java
22
pomArtifactId=authsignal-java
33
pomGroup=com.authsignal
44
pomPackaging=jar
5-
versionName=2.2.2
5+
versionName=2.3.0
66
versionCode=2025

src/main/java/com/authsignal/AuthsignalClient.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public class AuthsignalClient {
2222

2323
private static final String DEFAULT_API_URL = "https://api.authsignal.com/v1";
2424
private static final int DEFAULT_RETRIES = 2;
25+
private static final String VERSION = "2.3.0";
2526

2627
public Webhook webhook;
2728

@@ -119,6 +120,7 @@ private CompletableFuture<HttpResponse<String>> getRequest(String path) {
119120
HttpRequest request = HttpRequest.newBuilder()
120121
.uri(uri)
121122
.header("Authorization", getBasicAuthHeader())
123+
.header("X-Authsignal-Version", VERSION)
122124
.GET()
123125
.build();
124126

@@ -137,6 +139,7 @@ private CompletableFuture<HttpResponse<String>> postRequest(String path, String
137139
.uri(uri)
138140
.header("Authorization", getBasicAuthHeader())
139141
.header("Content-Type", "application/json")
142+
.header("X-Authsignal-Version", VERSION)
140143
.POST(HttpRequest.BodyPublishers.ofString(body))
141144
.build();
142145

@@ -155,6 +158,7 @@ private CompletableFuture<HttpResponse<String>> patchRequest(String path, String
155158
.uri(uri)
156159
.header("Authorization", getBasicAuthHeader())
157160
.header("Content-Type", "application/json")
161+
.header("X-Authsignal-Version", VERSION)
158162
.method("PATCH", HttpRequest.BodyPublishers.ofString(body))
159163
.build();
160164

@@ -172,6 +176,7 @@ private CompletableFuture<HttpResponse<String>> deleteRequest(String path) {
172176
HttpRequest request = HttpRequest.newBuilder()
173177
.uri(uri)
174178
.header("Authorization", getBasicAuthHeader())
179+
.header("X-Authsignal-Version", VERSION)
175180
.DELETE()
176181
.build();
177182

0 commit comments

Comments
 (0)