File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 4
4
"context"
5
5
"encoding/json"
6
6
"fmt"
7
+ "io"
7
8
"net/http"
8
9
"strings"
9
10
"time"
@@ -190,7 +191,19 @@ func (c *Client) HasFirstUser(ctx context.Context) (bool, error) {
190
191
return false , err
191
192
}
192
193
defer res .Body .Close ()
194
+
193
195
if res .StatusCode == http .StatusNotFound {
196
+ b , err := io .ReadAll (res .Body )
197
+ if err != nil {
198
+ return false , err
199
+ }
200
+ // ensure we are talking to coder and not
201
+ // some other service that returns 404
202
+ isCoder := strings .Contains (string (b ), "initial user has not been created" )
203
+ if ! isCoder {
204
+ return false , xerrors .Errorf ("unexpected response: %s" , string (b ))
205
+ }
206
+
194
207
return false , nil
195
208
}
196
209
if res .StatusCode != http .StatusOK {
You can’t perform that action at this time.
0 commit comments