File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 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 {
128128 httpapi .WriteBytes (rw , http .StatusOK , []byte ("Extension pages are not supported" ))
129129 })
130130
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+
131142 return api
132143}
133144
Original file line number Diff line number Diff line change 77 "io"
88 "net/http"
99 "net/http/httptest"
10+ "strings"
1011 "testing"
1112
1213 "github.com/stretchr/testify/require"
@@ -217,6 +218,16 @@ func TestAPI(t *testing.T) {
217218 Path : "/item" ,
218219 Status : http .StatusOK ,
219220 },
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+ },
220231 }
221232
222233 for _ , c := range cases {
@@ -245,7 +256,7 @@ func TestAPI(t *testing.T) {
245256
246257 var resp * http.Response
247258 var err error
248- if c .Path == "/api/extensionquery" {
259+ if strings . HasPrefix ( c .Path , "/api" ) {
249260 var body []byte
250261 if str , ok := c .Request .(string ); ok {
251262 body = []byte (str )
You can’t perform that action at this time.
0 commit comments