/token should provide pretty-printing
This commit is contained in:
		
							
								
								
									
										3
									
								
								app.rb
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								app.rb
									
									
									
									
									
								
							@@ -381,12 +381,15 @@ get "/pid", provides: "json" do
 | 
				
			|||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
get "/token", provides: "json" do
 | 
					get "/token", provides: "json" do
 | 
				
			||||||
 | 
					  pretty = params.key? :pretty
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  exp = Time.now.to_i + SECONDS_PER_MINUTE * 2
 | 
					  exp = Time.now.to_i + SECONDS_PER_MINUTE * 2
 | 
				
			||||||
  payload = {name: "anonymous", exp: exp, jti: Random.uuid}
 | 
					  payload = {name: "anonymous", exp: exp, jti: Random.uuid}
 | 
				
			||||||
  expires_at = Time.at(exp).to_datetime
 | 
					  expires_at = Time.at(exp).to_datetime
 | 
				
			||||||
  token = JWT.encode payload, config.jwt_secret.unwrap, "HS256"
 | 
					  token = JWT.encode payload, config.jwt_secret.unwrap, "HS256"
 | 
				
			||||||
  x = {token: token, expires_at: expires_at}
 | 
					  x = {token: token, expires_at: expires_at}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  jsonify x, pretty:
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
get "/token/validate" do
 | 
					get "/token/validate" do
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user