<commit_before>package me.izstas.rfs.server.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import me.izstas.rfs.server.config.web.PathWithinPattern;
import me.izstas.rfs.server.model.Metadata;
import me.izstas.rfs.server.service.MetadataService;

@RestController
@RequestMapping("/metadata/**")
public class MetadataController {
    @Autowired
    private MetadataService metadataService;

    @RequestMapping(method = RequestMethod.GET)
    public Metadata getMetadata(@PathWithinPattern String path) {
        return metadataService.getMetadataFromUserPath(path);
    }

    @RequestMapping(method = RequestMethod.POST)
    public void applyMetadata(@PathWithinPattern String path, @RequestBody Metadata metadata) {
        metadataService.applyMetadataToUserPath(path, metadata);
    }
}<commit_msg>Make POST request to /metadata/** return the new metadata instead of giving empty response<commit_after>package me.izstas.rfs.server.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import me.izstas.rfs.server.config.web.PathWithinPattern;
import me.izstas.rfs.server.model.Metadata;
import me.izstas.rfs.server.service.MetadataService;

@RestController
@RequestMapping("/metadata/**")
public class MetadataController {
    @Autowired
    private MetadataService metadataService;

    @RequestMapping(method = RequestMethod.GET)
    public Metadata getMetadata(@PathWithinPattern String path) {
        return metadataService.getMetadataFromUserPath(path);
    }

    @RequestMapping(method = RequestMethod.POST)
    public Metadata applyMetadata(@PathWithinPattern String path, @RequestBody Metadata metadata) {
        metadataService.applyMetadataToUserPath(path, metadata);
        return metadataService.getMetadataFromUserPath(path);
    }
}
{'fraction_non_alphanumeric': 0.09205384281372124, 'fraction_numerical': 0.0, 'mean_word_length': 5.678260869565217, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1091581', 'n_tokens_mistral': 614, 'n_tokens_neox': 609, 'n_words': 111}