kopia lustrzana https://github.com/simonw/datasette
				
				
				
			request.post_vars() no longer discards empty values
							rodzic
							
								
									9690ce6068
								
							
						
					
					
						commit
						0934844c0b
					
				| 
						 | 
				
			
			@ -80,7 +80,7 @@ class Request:
 | 
			
		|||
            body += message.get("body", b"")
 | 
			
		||||
            more_body = message.get("more_body", False)
 | 
			
		||||
 | 
			
		||||
        return dict(parse_qsl(body.decode("utf-8")))
 | 
			
		||||
        return dict(parse_qsl(body.decode("utf-8"), keep_blank_values=True))
 | 
			
		||||
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def fake(cls, path_with_query_string, method="GET", scheme="http"):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,10 +16,14 @@ async def test_request_post_vars():
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    async def receive():
 | 
			
		||||
        return {"type": "http.request", "body": b"foo=bar&baz=1", "more_body": False}
 | 
			
		||||
        return {
 | 
			
		||||
            "type": "http.request",
 | 
			
		||||
            "body": b"foo=bar&baz=1&empty=",
 | 
			
		||||
            "more_body": False,
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    request = Request(scope, receive)
 | 
			
		||||
    assert {"foo": "bar", "baz": "1"} == await request.post_vars()
 | 
			
		||||
    assert {"foo": "bar", "baz": "1", "empty": ""} == await request.post_vars()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def test_request_args():
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue