post

Post method on Angular 5. No error but it doesn't work

匆匆过客 提交于 2020-01-03 02:30:10
问题 When i am using post mehtod there is no error , but post method doesn't work this.http.post .(It worked yesterday, but today doesn't work. No idea) There is my service: import { Injectable } from '@angular/core'; import {HttpClient, HttpHeaders, HttpParams} from '@angular/common/http'; import {Observable} from 'rxjs/Observable'; import {GetData} from './data'; import {RequestMethod, RequestOptions} from '@angular/http'; import {Router} from '@angular/router'; @Injectable() export class

I get a 400 - bad request when I published my application on 'IIS', but before publishing it worked perfectly

不想你离开。 提交于 2020-01-03 01:42:12
问题 I have a angular application which works fine locally, but when published it on a test server it doesn't work any more some of my POST requests returns a 400 - bad request, and some don't, I have no idea why this is working locally but once published it doesn't. What I have tried: ►I am sure the test server has access to the database I'm connecting to since, previous versions of the application worked on it and other as well that uses the same database. ►I logged all my objects that I'm

HTTP Post multiple objects through PostAsJsonAsync

让人想犯罪 __ 提交于 2020-01-03 01:25:07
问题 I'm using HttpClient with some WebAPI. I need to send multiple objects to a POST, here's how my Post method is declared: public string Post(Models.Client value, App.ControlCenter.Models.Company c) { ... } And here's how I'm calling to the WebAPI: using (var client = new HttpClient()) { client.BaseAddress = new Uri("http://localhost/"); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var s = client

POSTing to https form not always working

强颜欢笑 提交于 2020-01-03 01:15:31
问题 On my site I have a simple login form. The page is served via HTTP, but the form's POST URL is HTTPS. The normal method is that the user fills in their username/password, the form is submitted (to the fully qualified HTTPS URL, on the same site), and then the POST processing does a 303 redirect to the users' homepage. But sometimes this doesn't happen. The cycle (and this is 100% repeatable) is this: Visit login form, fill in details and submit On the server the login script gets called,

Django的请求生命周期

瘦欲@ 提交于 2020-01-03 00:06:58
1. 概述 首先我们知道HTTP请求及服务端响应中传输的所有数据都是字符串. 在Django中,当我们访问一个的url时,会通过路由匹配进入相应的html网页中. Django的请求生命周期是指当用户在浏览器上输入url到用户看到网页的这个时间段内,Django后台所发生的事情 而Django的生命周期内到底发生了什么呢?? 1. 当用户在浏览器中输入url时,浏览器会生成请求头和请求体发给服务端 请求头和请求体中会包含浏览器的动作(action),这个动作通常为get或者post,体现在url之中. 2. url经过Django中的wsgi,再经过Django的中间件,最后url到过路由映射表,在路由中一条一条进行匹配, 一旦其中一条匹配成功就执行对应的视图函数,后面的路由就不再继续匹配了. 3. 视图函数根据客户端的请求查询相应的数据.返回给Django,然后Django把客户端想要的数据做为一个字符串返回给客户端. 4. 客户端浏览器接收到返回的数据,经过渲染后显示给用户. 视图函数根据客户端的请求查询相应的数据后.如果同时有多个客户端同时发送不同的url到服务端请求数据 服务端查询到数据后,怎么知道要把哪些数据返回给哪个客户端呢?? 因此客户端发到服务端的url中还必须要包含所要请求的数据信息等内容. 例如, http://www.aaa.com/index/?nid

Django中请求的生命周期

人走茶凉 提交于 2020-01-03 00:06:28
Django中请求的生命周期 1. 概述 首先我们知道HTTP请求及服务端响应中传输的所有数据都是字符串. 在Django中,当我们访问一个的url时,会通过路由匹配进入相应的html网页中. Django的请求生命周期是指当用户在浏览器上输入url到用户看到网页的这个时间段内,Django后台所发生的事情 而Django的生命周期内到底发生了什么呢?? 1. 当用户在浏览器中输入url时,浏览器会生成请求头和请求体发给服务端 请求头和请求体中会包含浏览器的动作(action),这个动作通常为get或者post,体现在url之中. 2. url经过Django中的wsgi,再经过Django的中间件,最后url到过路由映射表,在路由中一条一条进行匹配, 一旦其中一条匹配成功就执行对应的视图函数,后面的路由就不再继续匹配了. 3. 视图函数根据客户端的请求查询相应的数据.返回给Django,然后Django把客户端想要的数据做为一个字符串返回给客户端. 4. 客户端浏览器接收到返回的数据,经过渲染后显示给用户. 视图函数根据客户端的请求查询相应的数据后.如果同时有多个客户端同时发送不同的url到服务端请求数据 服务端查询到数据后,怎么知道要把哪些数据返回给哪个客户端呢?? 因此客户端发到服务端的url中还必须要包含所要请求的数据信息等内容. 例如, http://www.aaa

django请求的生命周期

谁说胖子不能爱 提交于 2020-01-03 00:06:15
1. 概述 首先我们知道HTTP请求及服务端响应中传输的所有数据都是字符串. 在Django中,当我们访问一个的url时,会通过路由匹配进入相应的html网页中. Django的请求生命周期是指当用户在浏览器上输入url到用户看到网页的这个时间段内,Django后台所发生的事情 而Django的生命周期内到底发生了什么呢?? 1. 当用户在浏览器中输入url时,浏览器会生成请求头和请求体发给服务端 请求头和请求体中会包含浏览器的动作(action),这个动作通常为get或者post,体现在url之中. 2. url经过Django中的wsgi,再经过Django的中间件,最后url到过路由映射表,在路由中一条一条进行匹配, 一旦其中一条匹配成功就执行对应的视图函数,后面的路由就不再继续匹配了. 3. 视图函数根据客户端的请求查询相应的数据.返回给Django,然后Django把客户端想要的数据做为一个字符串返回给客户端. 4. 客户端浏览器接收到返回的数据,经过渲染后显示给用户. 视图函数根据客户端的请求查询相应的数据后.如果同时有多个客户端同时发送不同的url到服务端请求数据 服务端查询到数据后,怎么知道要把哪些数据返回给哪个客户端呢?? 因此客户端发到服务端的url中还必须要包含所要请求的数据信息等内容. 例如, http://www.aaa.com/index/?nid

Django—views系统:views基础

时光怂恿深爱的人放手 提交于 2020-01-03 00:01:00
Django的View(视图)简介 一个视图函数(类),简称视图,是一个简单的Python 函数(类),它接受Web请求并且返回Web响应。 响应可以是一张网页的HTML内容,一个重定向,一个404错误,一个XML文档,或者一张图片。 无论视图本身包含什么逻辑,都要返回响应。 代码写在哪里也无所谓,只要它在你当前项目目录下面。 除此之外没有更多的要求了——可以说“没有什么神奇的地方”。 为了将代码放在某处,大家约定成俗将视图放置在项目(project)或应用程序(app)目录中的名为 views.py 的文件中。 一个简单的视图 下面是一个以HTML文档的形式返回当前日期和时间的视图: from django.http import HttpResponse import datetime def current_datetime(request): now = datetime.datetime.now() html = "<html><body>It is now %s.</body></html>" % now return HttpResponse(html)    让我们来逐行解释下上面的代码: 首先,我们从 django.http 模块导入了 HttpResponse 类,以及Python的 datetime 库。 接着,我们定义了 current_datetime

Django中的views函数

独自空忆成欢 提交于 2020-01-03 00:00:30
http请求中产生两个核心对象 http请求:HttpRequest对象 http响应:HttpResponse对象 一. http请求:HttpRequest对象 1、通过isinstance(request,HttpRequest)得知request就是HttpRequest类的实例化对象 eg: from django.shortcuts import HttpResponse, render, redirect from django.http import HttpRequest def year(request, year): print(isinstance(request, HttpRequest))return HttpResponse(year) 输出True Starting development server at http://127.0.0.1:8000/ Quit the server with CTRL-BREAK. True [05/May/2018 00:06:34] "GET /2018 HTTP/1.1" 200 4 2、 HttpRequest对象的方法和属性 属性:path,method,GET,POST,COOKIES,FILES,user,session path :请求页面的全路径,不包括域名和post内容 eg: def

How to pass data through a redirect to a view in laravel

≡放荡痞女 提交于 2020-01-02 21:56:13
问题 How can I pass data from a controller after it performs certain action to a view through a redirect() if I have a get route for it? The logic of the app is to redirect with an user_id to a view where the user will select its username after successfully verified its email. public function confirm($confirmationCode){ if(!$confirmationCode){ dd('No se encontró ningún código de verificación en la URL'); } $user = User::where('confirmation_code', $confirmationCode)->first(); if(!$user){ dd('Lo