mirror of
				https://github.com/karl0ss/homepage.git
				synced 2025-11-04 08:20:58 +00:00 
			
		
		
		
	handle proxy methods other than GET
This commit is contained in:
		
							parent
							
								
									bc2025b3ba
								
							
						
					
					
						commit
						53149df5f1
					
				@ -11,6 +11,7 @@ export default async function credentialedProxyHandler(req, res) {
 | 
				
			|||||||
    if (widget) {
 | 
					    if (widget) {
 | 
				
			||||||
      const url = new URL(formatApiCall(widget.type, { endpoint, ...widget }));
 | 
					      const url = new URL(formatApiCall(widget.type, { endpoint, ...widget }));
 | 
				
			||||||
      const [status, contentType, data] = await httpProxy(url, {
 | 
					      const [status, contentType, data] = await httpProxy(url, {
 | 
				
			||||||
 | 
					        method: req.method,
 | 
				
			||||||
        withCredentials: true,
 | 
					        withCredentials: true,
 | 
				
			||||||
        credentials: "include",
 | 
					        credentials: "include",
 | 
				
			||||||
        headers: {
 | 
					        headers: {
 | 
				
			||||||
 | 
				
			|||||||
@ -10,7 +10,9 @@ export default async function genericProxyHandler(req, res) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (widget) {
 | 
					    if (widget) {
 | 
				
			||||||
      const url = new URL(formatApiCall(widget.type, { endpoint, ...widget }));
 | 
					      const url = new URL(formatApiCall(widget.type, { endpoint, ...widget }));
 | 
				
			||||||
      const [status, contentType, data] = await httpProxy(url);
 | 
					      const [status, contentType, data] = await httpProxy(url, {
 | 
				
			||||||
 | 
					        method: req.method,
 | 
				
			||||||
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (contentType) res.setHeader("Content-Type", contentType);
 | 
					      if (contentType) res.setHeader("Content-Type", contentType);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user