Skip to content

Commit 5fd50d9

Browse files
committed
Fixed comments
1 parent 3b3e408 commit 5fd50d9

3 files changed

Lines changed: 5 additions & 6 deletions

File tree

src/FSharp.Data.GraphQL.Server.AspNetCore/RequestExecutionContext.fs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ type HttpContextRequestExecutionContext (httpContext : HttpContext) =
1414
let form = httpContext.Request.Form
1515
match (form.Files |> Seq.vtryFind (fun f -> f.Name = key)) with
1616
| ValueSome file ->
17-
let fileData = { Stream = file.OpenReadStream(); ContentType = file.ContentType }
18-
Ok (fileData)
17+
Ok { Stream = file.OpenReadStream (); ContentType = file.ContentType }
1918
| ValueNone -> Error $"File with key '{key}' not found"
2019

tests/FSharp.Data.GraphQL.Tests/FileTests.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type Input = {
2424
}
2525

2626
let private getFullInfo fileData =
27-
let reader = new StreamReader(fileData.Stream, Encoding.UTF8, true)
27+
use reader = new StreamReader(fileData.Stream, Encoding.UTF8, true)
2828
let fileContent = reader.ReadToEnd()
2929
fileContent + fileData.ContentType
3030

tests/FSharp.Data.GraphQL.Tests/Helpers.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ type ExecutorExtensions =
185185

186186
module MockInputContext =
187187

188-
let mockContentType = "text/plain"
188+
let mockContentType = System.Net.Mime.MediaTypeNames.Text.Plain
189189
let mockFileKey = "fileKey"
190190
let mockFileKey2 = "fileKey2"
191191
let mockFileText = "fileText"
@@ -211,9 +211,9 @@ module MockInputContext =
211211
interface IInputExecutionContext with
212212
member context.GetFile key =
213213
if (key = context.FileKey) then
214-
Ok { Stream = context.Stream; ContentType = "text/plain" }
214+
Ok { Stream = context.Stream; ContentType = mockContentType }
215215
else if (key = context.FileKey2) then
216-
Ok { Stream = context.Stream2; ContentType = "text/plain" }
216+
Ok { Stream = context.Stream2; ContentType = mockContentType }
217217
else
218218
failwith $"only file {context.FileKey} and file {context.FileKey2} exist"
219219

0 commit comments

Comments
 (0)