@@ -532,9 +532,10 @@ func Create(w http.ResponseWriter, r *http.Request, api *API, cName string, verb
532532 }
533533 //FIXME: If urlencoded data then redirect for the form to some URL. What is the way to indicate this?
534534 // Early web stuff used a hidden form field for this, seems really clunky.
535- if contentType == "application/json" {
535+ if contentType == "application/json" || successRedirect == "" {
536536 statusIsOK (w , http .StatusOK , cName , key , "updated" , "" )
537537 } else {
538+ // NOTE: we build the parameter list if successRedirect is not an empty string.
538539 statusIsOKText (w , r , http .StatusOK , cName , key , "updated" , "" , fmt .Sprintf ("%s?key=%s" , successRedirect , key ))
539540 }
540541 return
@@ -578,9 +579,10 @@ func Create(w http.ResponseWriter, r *http.Request, api *API, cName string, verb
578579 return
579580 }
580581 //FIXME: If urlencoded data then redirect for the form (is this in the referrer URL?)
581- if contentType == "application/json" {
582+ if contentType == "application/json" || successRedirect == "" {
582583 statusIsOK (w , http .StatusCreated , cName , key , "created" , "" )
583584 } else {
585+ // NOTE: we build the parameter list if successRedirect is not an empty string.
584586 statusIsOKText (w , r , http .StatusOK , cName , key , "updated" , "" , fmt .Sprintf ("%s?key=%s" , successRedirect , key ))
585587 }
586588 return
0 commit comments