@@ -6,6 +6,17 @@ var Parse = require('parse/node').Parse;
6
6
var auth = require ( './Auth' ) ;
7
7
var Config = require ( './Config' ) ;
8
8
9
+ function clientSDKFromVersion ( version ) {
10
+ let versionRE = / ( [ - a - z A - Z ] + ) ( [ 0 - 9 \. ] + ) / ;
11
+ let match = version . toLowerCase ( ) . match ( versionRE ) ;
12
+ if ( match && match . length === 3 ) {
13
+ return {
14
+ sdk : match [ 1 ] ,
15
+ version : match [ 2 ]
16
+ }
17
+ }
18
+ }
19
+
9
20
// Checks that the request is authorized for this app and checks user
10
21
// auth too.
11
22
// The bodyparser should run before this middleware.
@@ -25,7 +36,8 @@ function handleParseHeaders(req, res, next) {
25
36
clientKey : req . get ( 'X-Parse-Client-Key' ) ,
26
37
javascriptKey : req . get ( 'X-Parse-Javascript-Key' ) ,
27
38
dotNetKey : req . get ( 'X-Parse-Windows-Key' ) ,
28
- restAPIKey : req . get ( 'X-Parse-REST-API-Key' )
39
+ restAPIKey : req . get ( 'X-Parse-REST-API-Key' ) ,
40
+ clientVersion : req . get ( 'X-Parse-Client-Version' )
29
41
} ;
30
42
31
43
var basicAuth = httpAuth ( req ) ;
@@ -93,6 +105,10 @@ function handleParseHeaders(req, res, next) {
93
105
}
94
106
}
95
107
108
+ if ( info . clientVersion ) {
109
+ info . clientSDK = clientSDKFromVersion ( info . clientVersion ) ;
110
+ }
111
+
96
112
if ( fileViaJSON ) {
97
113
// We need to repopulate req.body with a buffer
98
114
var base64 = req . body . base64 ;
0 commit comments