tangled
alpha
login
or
join now
tjh.dev
/
core
forked from
tangled.org/core
0
fork
atom
this repo has no description
0
fork
atom
overview
issues
pulls
pipelines
appview/keys: be a little more http
anirudh.fi
1 year ago
010107ad
8fe42d6c
+13
-3
2 changed files
expand all
collapse all
unified
split
appview
state
state.go
knotserver
jetstream.go
+8
-3
appview/state/state.go
···
160
160
user = strings.TrimPrefix(user, "@")
161
161
162
162
if user == "" {
163
163
-
w.Write([]byte("not found"))
163
163
+
w.WriteHeader(http.StatusBadRequest)
164
164
return
165
165
}
166
166
167
167
id, err := auth.ResolveIdent(r.Context(), user)
168
168
if err != nil {
169
169
-
w.Write([]byte("not found"))
169
169
+
w.WriteHeader(http.StatusInternalServerError)
170
170
return
171
171
}
172
172
173
173
pubKeys, err := s.db.GetPublicKeys(id.DID.String())
174
174
if err != nil {
175
175
-
w.Write([]byte("not found"))
175
175
+
w.WriteHeader(http.StatusNotFound)
176
176
+
return
177
177
+
}
178
178
+
179
179
+
if len(pubKeys) == 0 {
180
180
+
w.WriteHeader(http.StatusNotFound)
176
181
return
177
182
}
178
183
+5
knotserver/jetstream.go
···
177
177
}
178
178
defer resp.Body.Close()
179
179
180
180
+
if resp.StatusCode == http.StatusNotFound {
181
181
+
l.Info("no keys found for did", "did", did)
182
182
+
return nil
183
183
+
}
184
184
+
180
185
if ct := resp.Header.Get("Content-Type"); !strings.HasPrefix(ct, "text/plain") {
181
186
return fmt.Errorf("unexpected content type: %s", ct)
182
187
}