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()
100
100
101
101
private void Process ( HttpListenerContext context )
102
102
{
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
+ }
104
116
105
117
var filename = context . Request . Url . AbsolutePath ;
106
- Logger . Info ( $ "{ filename } ") ;
107
118
filename = filename . TrimStart ( '/' ) ;
108
119
filename = filename . Replace ( '/' , Path . DirectorySeparatorChar ) ;
109
120
filename = Path . Combine ( rootDirectory , filename ) ;
110
121
111
122
if ( ! File . Exists ( filename ) )
112
123
{
113
124
context . Response . StatusCode = ( int ) HttpStatusCode . NotFound ;
125
+ Logger . Info ( $ "Path not found - Returning 404") ;
114
126
context . Response . Close ( ) ;
115
127
return ;
116
128
}
You can’t perform that action at this time.
0 commit comments