Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1027 from OpenBazaar/async
Browse files Browse the repository at this point in the history
Add optional asyncID query param to async API calls
  • Loading branch information
cpacia committed Jul 22, 2018
2 parents d80de25 + fe811c7 commit 786e594
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions api/jsonapi.go
Expand Up @@ -1803,9 +1803,12 @@ func (i *jsonAPIHandler) GETModerators(w http.ResponseWriter, r *http.Request) {
}
SanitizedResponse(w, resp)
} else {
idBytes := make([]byte, 16)
rand.Read(idBytes)
id := base58.Encode(idBytes)
id := r.URL.Query().Get("asyncID")
if id == "" {
idBytes := make([]byte, 16)
rand.Read(idBytes)
id = base58.Encode(idBytes)
}

type resp struct {
Id string `json:"id"`
Expand Down Expand Up @@ -2623,9 +2626,12 @@ func (i *jsonAPIHandler) POSTFetchProfiles(w http.ResponseWriter, r *http.Reques
resp += "\n]"
SanitizedResponse(w, resp)
} else {
idBytes := make([]byte, 16)
rand.Read(idBytes)
id := base58.Encode(idBytes)
id := r.URL.Query().Get("asyncID")
if id == "" {
idBytes := make([]byte, 16)
rand.Read(idBytes)
id = base58.Encode(idBytes)
}

type resp struct {
Id string `json:"id"`
Expand Down Expand Up @@ -3366,9 +3372,12 @@ func (i *jsonAPIHandler) POSTFetchRatings(w http.ResponseWriter, r *http.Request
resp += "\n]"
SanitizedResponse(w, resp)
} else {
idBytes := make([]byte, 16)
rand.Read(idBytes)
id := base58.Encode(idBytes)
id := r.URL.Query().Get("asyncID")
if id == "" {
idBytes := make([]byte, 16)
rand.Read(idBytes)
id = base58.Encode(idBytes)
}

type resp struct {
Id string `json:"id"`
Expand Down

0 comments on commit 786e594

Please sign in to comment.