This repository was archived by the owner on Dec 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -100,17 +100,29 @@ public void Abort()
100100
101101 private void Process ( HttpListenerContext context )
102102 {
103- Logger . Info ( $ "Handling request") ;
103+ Logger . Info ( "Handling request {0}" , context . Request . Url . AbsolutePath ) ;
104+
105+ if ( context . Request . Url . AbsolutePath == "/api/usage/unity" )
106+ {
107+ context . Response . StatusCode = ( int ) HttpStatusCode . OK ;
108+
109+ var streamWriter = new StreamWriter ( context . Response . OutputStream ) ;
110+ streamWriter . Write ( "Cool Unity usage bro!" ) ;
111+ streamWriter . Flush ( ) ;
112+
113+ context . Response . Close ( ) ;
114+ return ;
115+ }
104116
105117 var filename = context . Request . Url . AbsolutePath ;
106- Logger . Info ( $ "{ filename } ") ;
107118 filename = filename . TrimStart ( '/' ) ;
108119 filename = filename . Replace ( '/' , Path . DirectorySeparatorChar ) ;
109120 filename = Path . Combine ( rootDirectory , filename ) ;
110121
111122 if ( ! File . Exists ( filename ) )
112123 {
113124 context . Response . StatusCode = ( int ) HttpStatusCode . NotFound ;
125+ Logger . Info ( $ "Path not found - Returning 404") ;
114126 context . Response . Close ( ) ;
115127 return ;
116128 }
You can’t perform that action at this time.
0 commit comments