fix promise not being awaited
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			This commit is contained in:
		@@ -280,7 +280,7 @@ export default function create_auth_handler (
 | 
				
			|||||||
    const token = (/(?<type>\S+) (?<token>.+)/ui)
 | 
					    const token = (/(?<type>\S+) (?<token>.+)/ui)
 | 
				
			||||||
      .exec (req.headers.authorization as string);
 | 
					      .exec (req.headers.authorization as string);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    process_request (request, token, default_handler, options);
 | 
					    await process_request (request, token, default_handler, options);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return request.is_successful;
 | 
					    return request.is_successful;
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "name": "@sapphirecode/auth-server-helper",
 | 
					  "name": "@sapphirecode/auth-server-helper",
 | 
				
			||||||
  "version": "2.1.3",
 | 
					  "version": "2.1.4",
 | 
				
			||||||
  "main": "dist/index.js",
 | 
					  "main": "dist/index.js",
 | 
				
			||||||
  "author": {
 | 
					  "author": {
 | 
				
			||||||
    "name": "Timo Hocker",
 | 
					    "name": "Timo Hocker",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -102,7 +102,9 @@ describe ('auth handler', () => {
 | 
				
			|||||||
          access_token_expires_in: expires_seconds,
 | 
					          access_token_expires_in: expires_seconds,
 | 
				
			||||||
          leave_open:              true
 | 
					          leave_open:              true
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        req.response.end ('custom response');
 | 
					        req.response.write ('custom response, ');
 | 
				
			||||||
 | 
					        (req.response.connection as unknown as Record<string, unknown>)
 | 
				
			||||||
 | 
					          .append_flag = true;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      else {
 | 
					      else {
 | 
				
			||||||
        req.deny ();
 | 
					        req.deny ();
 | 
				
			||||||
@@ -128,8 +130,13 @@ describe ('auth handler', () => {
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    server = http.createServer ((req: IncomingMessage, res: ServerResponse) => {
 | 
					    server = http.createServer (async (
 | 
				
			||||||
      ah (req, res);
 | 
					      req: IncomingMessage,
 | 
				
			||||||
 | 
					      res: ServerResponse
 | 
				
			||||||
 | 
					    ) => {
 | 
				
			||||||
 | 
					      const is_successful = await ah (req, res);
 | 
				
			||||||
 | 
					      if ((res.connection as unknown as Record<string, unknown>).append_flag)
 | 
				
			||||||
 | 
					        res.end (String (is_successful));
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    server.listen (3000);
 | 
					    server.listen (3000);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
@@ -338,7 +345,7 @@ describe ('auth handler', () => {
 | 
				
			|||||||
    expect (resp1.headers['content-type'])
 | 
					    expect (resp1.headers['content-type'])
 | 
				
			||||||
      .toEqual ('text/plain');
 | 
					      .toEqual ('text/plain');
 | 
				
			||||||
    expect (resp1.body)
 | 
					    expect (resp1.body)
 | 
				
			||||||
      .toEqual ('custom response');
 | 
					      .toEqual ('custom response, true');
 | 
				
			||||||
    let signature = '';
 | 
					    let signature = '';
 | 
				
			||||||
    for (const c of resp1.headers['set-cookie'] as string[]) {
 | 
					    for (const c of resp1.headers['set-cookie'] as string[]) {
 | 
				
			||||||
      if (c.includes ('cookie_jar='))
 | 
					      if (c.includes ('cookie_jar='))
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user