question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to set POST request as default?

See original GitHub issue

Trying to set POST as default request type, but getting it wrong. Current container is Autofac.

var builder = new ContainerBuilder();
builder.RegisterType<PostSolrConnection>()
                   .Named<ISolrConnection>("SolrConnection")
                   .WithParameter("serverUrl", serverUrl);

builder.RegisterModule(new SolrNetModule(serverUrl));
var container = builder.Build();

var solr = container.Resolve<ISolrOperations<Product>>();

Still getting GET as default request. This/this links won’t help. I’m wondering if PostSolrConnection is included in lib.

How can I set POST request as default?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:16 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
xmoreracommented, Dec 12, 2017

@mmoldabe that is a different issue, please add an extra param “wt” with value “xml”

options.ExtraParams = new KeyValuePair<string,string>[] { new KeyValuePair<string,string>(“wt”, “xml”) };

2reactions
mmoldabecommented, Dec 12, 2017

@gjunge trying to run your snippet using Ninject Module, but getting same error as for Autofac:

System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.
in System.Xml.XmlTextReaderImpl.Throw(Exception e) in System.Xml.XmlTextReaderImpl.Throw(String res, String arg) in System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace() in System.Xml.XmlTextReaderImpl.ParseDocumentContent() in System.Xml.XmlTextReaderImpl.Read() in System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options) in System.Xml.Linq.XDocument.Parse(String text, LoadOptions options) in SolrNet.Impl.SolrQueryExecuter1.Execute(ISolrQuery q, QueryOptions options) in C:\projects\solrnet-crl26\SolrNet\Impl\SolrQueryExecuter.cs:line 673 in SolrNet.Impl.SolrBasicServer1.Query(ISolrQuery query, QueryOptions options) in C:\projects\solrnet-crl26\SolrNet\Impl\SolrBasicServer.cs:line 116 in SolrNet.Impl.SolrServer1.Query(ISolrQuery query, QueryOptions options) in C:\projects\solrnet-crl26\SolrNet\Impl\SolrServer.cs:line 54 in SolrNet.Impl.SolrServer1.Query(ISolrQuery q) in C:\projects\solrnet-crl26\SolrNet\Impl\SolrServer.cs:line 96

This is for standard q=sample query. This happens for both Autofac and Ninject when trying to do PostSolrConnection. Guess, this happens before SolrNet sends request to Solr server, because Solr and Fiddler logs are empty. I wonder why this happens and how to fix that. Can you help?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Set Defaults and Validate POST Request - node.js
In the schema, You can use default(...) which will allow to to specify default values of the fields (in that case when title...
Read more >
Ajax request type can be set to GET (POST by default)
If the httpMethod property is not set, it defaults to POST. Views now uses GET requests by default when the "Use AJAX"
Read more >
POST - HTTP - MDN Web Docs
The HTTP POST method sends data to the server. ... A simple form using the default application/x-www-form-urlencoded content type: http
Read more >
jQuery.post( url [, data ] [, success ] [, dataType ] )Returns
A set of key/value pairs that configure the Ajax request. All properties except for url are optional. A default can be set for...
Read more >
GET vs POST - Difference and Comparison
HTTP POST requests supply additional data from the client (browser) to the server ... use either method by specifying method='POST' or method='GET' (default)....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found