@@ -12,26 +12,26 @@ class PostHandler extends BaseHandler {
1212 * @return {function }
1313 */
1414 send ( req , res ) {
15- const length = req . headers [ 'upload-length' ] ;
16- const defer_length = req . headers [ 'upload-defer-length' ] ;
15+ const upload_length = req . headers [ 'upload-length' ] ;
16+ const upload_defer_length = req . headers [ 'upload-defer-length' ] ;
1717 // The request MUST include a Upload-Length or Upload-Defer-Length header
18- if ( length === undefined && defer_length === undefined ) {
18+ if ( upload_length === undefined && upload_defer_length === undefined ) {
1919 return super . send ( res , 400 , { } , 'Upload-Length or Upload-Defer-Length Required' ) ;
2020 }
2121
2222 // The value MUST be a non-negative integer.
23- if ( length && ( isNaN ( length ) || parseInt ( length , 10 ) < 0 ) ) {
24- console . warn ( `[PostHandler] Invalid Upload-Length: ${ length } ` )
23+ if ( upload_length && ( isNaN ( upload_length ) || parseInt ( upload_length , 10 ) < 0 ) ) {
24+ console . warn ( `[PostHandler] Invalid Upload-Length: ${ upload_length } ` ) ;
2525 return super . send ( res , 400 , { } , 'Invalid Upload-Length' ) ;
2626 }
2727
2828 // The Upload-Defer-Length value MUST be 1.
29- if ( defer_length && ( isNaN ( defer_length ) || parseInt ( defer_length , 10 ) !== 1 ) ) {
30- console . warn ( `[PostHandler] Invalid Upload-Defer-Length: ${ defer_length } ` )
29+ if ( upload_defer_length && ( isNaN ( upload_defer_length ) || parseInt ( upload_defer_length , 10 ) !== 1 ) ) {
30+ console . warn ( `[PostHandler] Invalid Upload-Defer-Length: ${ upload_defer_length } ` ) ;
3131 return super . send ( res , 400 , { } , 'Invalid Upload-Defer-Length' ) ;
3232 }
3333
34- const file = new File ( length , defer_length ) ;
34+ const file = new File ( upload_length , upload_defer_length ) ;
3535 return this . store . create ( file )
3636 . then ( ( location ) => {
3737 const url = `http://${ req . headers . host } ${ this . store . path } /${ file . id } ` ;
0 commit comments