Skip to content

Instantly share code, notes, and snippets.

@prodigysml
Created January 23, 2023 01:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prodigysml/d92ee3364907937d66ce04f432186f92 to your computer and use it in GitHub Desktop.
Save prodigysml/d92ee3364907937d66ce04f432186f92 to your computer and use it in GitHub Desktop.
Bugcrowd Mystique Hint #1
public class Test {
...
//...... generate registration payload
//String payload = String.format("{\"username\":\"new_user\",\"publicKey\":\"%s\"}", encodedpubkey);
String payload = String.format("{\"username\":\"new_user\",\"publicKey\":\"%s\"}", encodedpubkey);
//...... register user
var uri = URI.create("http://127.0.0.1:3000/register");
var client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(uri)
//.POST(HttpRequest.BodyPublishers.ofString(payload))
.POST(HttpRequest.BodyPublishers.ofString(payload))
.headers("Content-Type", "application/json")
.build();
try {
var response = client.send(request, HttpResponse.BodyHandlers.ofString(StandardCharsets.UTF_8));
System.out.println(response.statusCode());
System.out.println(response.body());
} catch (IOException ex) {
} catch (InterruptedException ex) {
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment