<commit_before>module EventStoreProjections

#I @"..\packages\RestSharp\lib\net4"
#r "RestSharp.dll"

open RestSharp

let postProjection name projection =
    let host = "http://localhost:2113"
    let mutable client = new RestClient(host)
    client.Authenticator <- new HttpBasicAuthenticator("admin","changeit");

    let resource = sprintf "/projections/continuous?name=%s&emit=yes&checkpoints=yes&enabled=yes" name

    let mutable request = new RestRequest(resource, Method.POST)
    request.RequestFormat <- DataFormat.Json
    request.AddParameter(@"application\json", projection, ParameterType.RequestBody) |> ignore 
    printfn "Posting to: %s%s" host resource
    let response = client.Execute(request);
    printfn "Status code: %A" response.StatusCode
    printfn "Body: %s" response.Content<commit_msg>content type header copy-pasted off internet had wrong slash, which made ES return 500<commit_after>module EventStoreProjections

#I @"..\packages\RestSharp\lib\net4"
#r "RestSharp.dll"

open RestSharp

let postProjection name projection =
    let host = "http://localhost:2113"
    let mutable client = new RestClient(host)
    client.Authenticator <- new HttpBasicAuthenticator("admin","changeit");

    let resource = sprintf "/projections/continuous?name=%s&emit=yes&checkpoints=yes&enabled=yes" name

    let mutable request = new RestRequest(resource, Method.POST)
    request.RequestFormat <- DataFormat.Json
    request.AddParameter(@"application/json", projection, ParameterType.RequestBody) |> ignore 
    printfn "Posting to: %s%s" host resource
    let response = client.Execute(request);
    printfn "Status code: %A" response.StatusCode
    printfn "Body: %s" response.Content
{'fraction_non_alphanumeric': 0.11130638547158758, 'fraction_numerical': 0.007615700058582308, 'mean_word_length': 4.829351535836177, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '226585', 'n_tokens_mistral': 516, 'n_tokens_neox': 485, 'n_words': 128}