File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 1
1
import express from 'express' ;
2
2
import expressJwt from 'express-jwt' ;
3
3
import validate from 'express-validation' ;
4
+ import omit from 'lodash/omit' ;
4
5
import paramValidation from '../../config/param-validation' ;
5
6
import postCtrl from '../controllers/post.controller' ;
6
7
import voteCtrl from '../controllers/vote.controller' ;
@@ -14,8 +15,17 @@ import loadFullUser from '../middleware/loadFullUser.middleware';
14
15
15
16
const router = express . Router ( ) ; // eslint-disable-line new-cap
16
17
18
+ // @TODO : Remove this after it's fixed in iOS
19
+ const jwtCleanUp = ( req , res , next ) => {
20
+ if ( req . headers . authorization && ! req . headers . authorization . split ( ' ' ) [ 1 ] ) {
21
+ req . headers = omit ( req . headers , 'authorization' ) ;
22
+ }
23
+ next ( ) ;
24
+ } ;
25
+
17
26
router . route ( '/' )
18
27
. get (
28
+ jwtCleanUp ,
19
29
expressJwt ( {
20
30
secret : config . jwtSecret ,
21
31
credentialsRequired : false ,
You can’t perform that action at this time.
0 commit comments