Set "Created" field for new-order. (#4013)
This will allow us to connect new-order requests with the order URLs that are created as a result. Also ensure the Requester is filled in for new-acct requests that return an existing account (it's already filled in for new-acct requests that create an account).
This commit is contained in:
parent
413028aa1b
commit
bf7f638a25
|
|
@ -485,6 +485,7 @@ func (wfe *WebFrontEndImpl) NewAccount(
|
||||||
if err == nil {
|
if err == nil {
|
||||||
response.Header().Set("Location",
|
response.Header().Set("Location",
|
||||||
web.RelativeEndpoint(request, fmt.Sprintf("%s%d", acctPath, existingAcct.ID)))
|
web.RelativeEndpoint(request, fmt.Sprintf("%s%d", acctPath, existingAcct.ID)))
|
||||||
|
logEvent.Requester = existingAcct.ID
|
||||||
|
|
||||||
err = wfe.writeJsonResponse(response, logEvent, http.StatusOK, existingAcct)
|
err = wfe.writeJsonResponse(response, logEvent, http.StatusOK, existingAcct)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -1675,6 +1676,7 @@ func (wfe *WebFrontEndImpl) NewOrder(
|
||||||
wfe.sendError(response, logEvent, web.ProblemDetailsForError(err, "Error creating new order"), err)
|
wfe.sendError(response, logEvent, web.ProblemDetailsForError(err, "Error creating new order"), err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
logEvent.Created = fmt.Sprintf("%d", *order.Id)
|
||||||
|
|
||||||
orderURL := web.RelativeEndpoint(request,
|
orderURL := web.RelativeEndpoint(request,
|
||||||
fmt.Sprintf("%s%d/%d", orderPath, acct.ID, *order.Id))
|
fmt.Sprintf("%s%d/%d", orderPath, acct.ID, *order.Id))
|
||||||
|
|
|
||||||
|
|
@ -2072,6 +2072,17 @@ func TestNewOrder(t *testing.T) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test that we log the "Created" field.
|
||||||
|
responseWriter.Body.Reset()
|
||||||
|
responseWriter.HeaderMap = http.Header{}
|
||||||
|
request := signAndPost(t, targetPath, signedURL, validOrderBody, 1, wfe.nonceService)
|
||||||
|
requestEvent := newRequestEvent()
|
||||||
|
wfe.NewOrder(ctx, requestEvent, responseWriter, request)
|
||||||
|
|
||||||
|
if requestEvent.Created != "1" {
|
||||||
|
t.Errorf("Expected to log Created field when creating Order: %#v", requestEvent)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFinalizeOrder(t *testing.T) {
|
func TestFinalizeOrder(t *testing.T) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue