File tree 2 files changed +23
-1
lines changed
2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,17 @@ func New(options *Options) *API {
128
128
httpapi .WriteBytes (rw , http .StatusOK , []byte ("Extension pages are not supported" ))
129
129
})
130
130
131
+ // Web extensions post stats to this endpoint.
132
+ r .Post ("/api/itemName/{publisher}.{name}/version/{version}/statType/{type}/vscodewebextension" , func (rw http.ResponseWriter , r * http.Request ) {
133
+ httpapi .WriteBytes (rw , http .StatusOK , []byte ("Extension stats are not supported" ))
134
+ })
135
+
136
+ // Non-web extensions post stats to this endpoint.
137
+ r .Post ("/api/publishers/{publisher}/extensions/{name}/{version}/stats" , func (rw http.ResponseWriter , r * http.Request ) {
138
+ // Will have a `statType` query param.
139
+ httpapi .WriteBytes (rw , http .StatusOK , []byte ("Extension stats are not supported" ))
140
+ })
141
+
131
142
return api
132
143
}
133
144
Original file line number Diff line number Diff line change 7
7
"io"
8
8
"net/http"
9
9
"net/http/httptest"
10
+ "strings"
10
11
"testing"
11
12
12
13
"github.com/stretchr/testify/require"
@@ -217,6 +218,16 @@ func TestAPI(t *testing.T) {
217
218
Path : "/item" ,
218
219
Status : http .StatusOK ,
219
220
},
221
+ {
222
+ Name : "WebExtensionStat" ,
223
+ Path : "/api/itemName/vscodevim.vim/version/1.23.1/statType/1/vscodewebextension" ,
224
+ Status : http .StatusOK ,
225
+ },
226
+ {
227
+ Name : "ExtensionStat" ,
228
+ Path : "/api/publishers/vscodevim/extensions/vim/1.23.1/stats?statType=1" ,
229
+ Status : http .StatusOK ,
230
+ },
220
231
}
221
232
222
233
for _ , c := range cases {
@@ -245,7 +256,7 @@ func TestAPI(t *testing.T) {
245
256
246
257
var resp * http.Response
247
258
var err error
248
- if c .Path == "/api/extensionquery" {
259
+ if strings . HasPrefix ( c .Path , "/api" ) {
249
260
var body []byte
250
261
if str , ok := c .Request .(string ); ok {
251
262
body = []byte (str )
You can’t perform that action at this time.
0 commit comments