mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 03:09:04 +01:00
Include pending contact id in error response
This commit is contained in:
@@ -175,6 +175,7 @@ possible attack.
|
||||
```json
|
||||
{
|
||||
"error": "PENDING_EXISTS",
|
||||
"pendingContactId": "jsTgWcsEQ2g9rnomeK1g/hmO8M1Ix6ZIGWAjgBtlS9U=",
|
||||
"pendingContactAlias": "Alice"
|
||||
}
|
||||
```
|
||||
|
||||
@@ -117,8 +117,11 @@ constructor(
|
||||
return ctx.json(details)
|
||||
} catch (e: PendingContactExistsException) {
|
||||
ctx.status(FORBIDDEN_403)
|
||||
val details =
|
||||
mapOf("error" to "PENDING_EXISTS", "pendingContactAlias" to e.pendingContact.alias)
|
||||
val details = mapOf(
|
||||
"error" to "PENDING_EXISTS",
|
||||
"pendingContactId" to e.pendingContact.id.bytes,
|
||||
"pendingContactAlias" to e.pendingContact.alias
|
||||
)
|
||||
return ctx.json(details)
|
||||
}
|
||||
return ctx.json(pendingContact.output())
|
||||
|
||||
@@ -132,9 +132,12 @@ class ContactControllerIntegrationTest: IntegrationTest() {
|
||||
var response = post("$url/contacts/add/pending", json)
|
||||
assertEquals(200, response.statusCode)
|
||||
|
||||
val pendingContactId = response.jsonObject.getString("pendingContactId")
|
||||
|
||||
response = post("$url/contacts/add/pending", json)
|
||||
assertEquals(403, response.statusCode)
|
||||
assertEquals("PENDING_EXISTS", response.jsonObject.getString("error"))
|
||||
assertEquals(pendingContactId, response.jsonObject.getString("pendingContactId"))
|
||||
assertEquals(alias, response.jsonObject.getString("pendingContactAlias"))
|
||||
}
|
||||
|
||||
|
||||
@@ -216,6 +216,7 @@ internal class ContactControllerTest : ControllerTest() {
|
||||
ctx.json(
|
||||
mapOf(
|
||||
"error" to "PENDING_EXISTS",
|
||||
"pendingContactId" to pendingContact.id.bytes,
|
||||
"pendingContactAlias" to pendingContact.alias
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user