<commit_before>package controllers

import (
	"github.com/astaxie/beego"
	"encoding/json"
	"github.com/stef-k/gosimple/utils"
)

type RegistrationController struct {
	beego.Controller
}

// @Title register
// @Description register a new user
// @Success 200 {string}
// @Failure 403 body is empty
// @router /register/ [post]
func (rc *RegistrationController) Register() {
	registrationIsOpen, _ := beego.AppConfig.Bool("registration::is_open")
	if registrationIsOpen {
		var re utils.Registration
		json.Unmarshal(rc.Ctx.Input.RequestBody, &re)
		utils.ValidateRegistration(&re)
		errors := utils.ValidateRegistration(&re)
		if len(errors) > 0 {
			rc.Data["json"] = errors
		} else {
			// register the user and return a success message
			rc.Data["json"] = map[string]string{"response": "success"}
		}
	}
	rc.ServeJSON()
}
<commit_msg>registration closed response, correct API doc<commit_after>package controllers

import (
	"github.com/astaxie/beego"
	"encoding/json"
	"github.com/stef-k/gosimple/utils"
)

type RegistrationController struct {
	beego.Controller
}

// @Title register
// @Description register a new user
// @Success 200 {string}
// @Failure 400 body is empty
// @router /register/ [post]
func (rc *RegistrationController) Register() {
	registrationIsOpen, _ := beego.AppConfig.Bool("registration::is_open")
	if registrationIsOpen {
		var re utils.Registration
		json.Unmarshal(rc.Ctx.Input.RequestBody, &re)
		utils.ValidateRegistration(&re)
		errors := utils.ValidateRegistration(&re)
		if len(errors) > 0 {
			rc.Data["json"] = errors
		} else {
			// register the user and return a success message
			rc.Data["json"] = map[string]string{"response": "success"}
		}
	} else {
		rc.Data["json"] = "Registration is closed."
	}
	rc.ServeJSON()
}

{'fraction_non_alphanumeric': 0.1383219954648526, 'fraction_numerical': 0.007936507936507936, 'mean_word_length': 4.332326283987915, 'pattern_counts': {'":': 2, '<': 3, '<?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': '3072411', 'n_tokens_mistral': 614, 'n_tokens_neox': 569, 'n_words': 134}