<commit_before>class Api::MessagesController < ApplicationController
  skip_before_action :verify_authenticity_token
  doorkeeper_for :all

  respond_to :json

  def index
    @messages = Message.all
    render json: @messages
  end

  def show
    @message = Message.find(params.fetch(:id))
    render json: @message
  end

  def create<commit_msg>Make OAuth optional for API::MessagesController#create<commit_after>class Api::MessagesController < ApplicationController
  skip_before_action :verify_authenticity_token
  doorkeeper_for :all, except: [ :create ]

  respond_to :json

  def index
    @messages = Message.all
    render json: @messages
  end

  def show
    @message = Message.find(params.fetch(:id))
    render json: @message
  end

  def create
    # HACK: This validates the oauth token if it is passed in.
    methods = Doorkeeper.configuration.access_token_methods
    @token ||= Doorkeeper::OAuth::Token.authenticate request, *methods

{'fraction_non_alphanumeric': 0.07853403141361257, 'fraction_numerical': 0.0, 'mean_word_length': 4.252747252747253, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3388549', 'n_tokens_mistral': 283, 'n_tokens_neox': 273, 'n_words': 76}